From: Karim Yaghmour <karim@opersys.com>

signed-off-by: Karim Yaghmour <karim@opersys.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/buffer.c        |    3 +++
 25-akpm/fs/exec.c          |    4 ++++
 25-akpm/fs/ioctl.c         |    4 +++-
 25-akpm/fs/open.c          |    6 ++++++
 25-akpm/fs/read_write.c    |   19 +++++++++++++++++--
 25-akpm/fs/relayfs/relay.c |    3 +--
 25-akpm/fs/select.c        |    4 ++++
 7 files changed, 38 insertions(+), 5 deletions(-)

diff -puN fs/buffer.c~ltt-fs-events fs/buffer.c
--- 25/fs/buffer.c~ltt-fs-events	2005-01-23 19:12:01.768760864 -0800
+++ 25-akpm/fs/buffer.c	2005-01-23 19:12:01.782758736 -0800
@@ -39,6 +39,7 @@
 #include <linux/notifier.h>
 #include <linux/cpu.h>
 #include <linux/bitops.h>
+#include <linux/ltt-events.h>
 
 static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
 static void invalidate_bh_lrus(void);
@@ -87,7 +88,9 @@ void fastcall unlock_buffer(struct buffe
  */
 void __wait_on_buffer(struct buffer_head * bh)
 {
+	ltt_ev_file_system(LTT_EV_FILE_SYSTEM_BUF_WAIT_START, 0, 0, NULL);
 	wait_on_bit(&bh->b_state, BH_Lock, sync_buffer, TASK_UNINTERRUPTIBLE);
+	ltt_ev_file_system(LTT_EV_FILE_SYSTEM_BUF_WAIT_END, 0, 0, NULL);
 }
 
 static void
diff -puN fs/exec.c~ltt-fs-events fs/exec.c
--- 25/fs/exec.c~ltt-fs-events	2005-01-23 19:12:01.769760712 -0800
+++ 25-akpm/fs/exec.c	2005-01-23 19:12:01.783758584 -0800
@@ -48,6 +48,7 @@
 #include <linux/syscalls.h>
 #include <linux/rmap.h>
 #include <linux/acct.h>
+#include <linux/ltt-events.h>
 
 #include <asm/uaccess.h>
 #include <asm/mmu_context.h>
@@ -1140,6 +1141,9 @@ int do_execve(char * filename,
 	if (IS_ERR(file))
 		goto out_kfree;
 
+	ltt_ev_file_system(LTT_EV_FILE_SYSTEM_EXEC, 0,
+			file->f_dentry->d_name.len, file->f_dentry->d_name.name);
+
 	sched_exec();
 
 	bprm->p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
diff -puN fs/ioctl.c~ltt-fs-events fs/ioctl.c
--- 25/fs/ioctl.c~ltt-fs-events	2005-01-23 19:12:01.771760408 -0800
+++ 25-akpm/fs/ioctl.c	2005-01-23 19:12:01.784758432 -0800
@@ -11,6 +11,7 @@
 #include <linux/file.h>
 #include <linux/fs.h>
 #include <linux/security.h>
+#include <linux/ltt-events.h>
 #include <linux/module.h>
 
 #include <asm/uaccess.h>
@@ -60,7 +61,6 @@ static int file_ioctl(struct file *filp,
 				return -EPERM;
 			if ((error = get_user(block, p)) != 0)
 				return error;
-
 			lock_kernel();
 			res = mapping->a_ops->bmap(mapping, block);
 			unlock_kernel();
@@ -166,6 +166,8 @@ asmlinkage long sys_ioctl(unsigned int f
 	if (!filp)
 		goto out;
 
+	ltt_ev_file_system(LTT_EV_FILE_SYSTEM_IOCTL, fd, cmd, NULL);
+
 	error = security_file_ioctl(filp, cmd, arg);
 	if (error)
 		goto out_fput;
diff -puN fs/open.c~ltt-fs-events fs/open.c
--- 25/fs/open.c~ltt-fs-events	2005-01-23 19:12:01.773760104 -0800
+++ 25-akpm/fs/open.c	2005-01-23 19:12:26.750962992 -0800
@@ -20,6 +20,8 @@
 #include <linux/security.h>
 #include <linux/mount.h>
 #include <linux/vfs.h>
+#include <linux/ltt-events.h>
+
 #include <asm/uaccess.h>
 #include <linux/fs.h>
 #include <linux/pagemap.h>
@@ -952,6 +954,9 @@ asmlinkage long sys_open(const char __us
 					IN_OPEN, 0, NULL);
 			inotify_dentry_parent_queue_event(f->f_dentry, IN_OPEN,
 					0, f->f_dentry->d_name.name);
+			ltt_ev_file_system(LTT_EV_FILE_SYSTEM_OPEN, fd,
+				f->f_dentry->d_name.len,
+				f->f_dentry->d_name.name);
 			fd_install(fd, f);
 		}
 out:
@@ -1027,6 +1032,7 @@ asmlinkage long sys_close(unsigned int f
 	filp = files->fd[fd];
 	if (!filp)
 		goto out_unlock;
+	ltt_ev_file_system(LTT_EV_FILE_SYSTEM_CLOSE, fd, 0, NULL);
 	files->fd[fd] = NULL;
 	FD_CLR(fd, files->close_on_exec);
 	__put_unused_fd(files, fd);
diff -puN fs/read_write.c~ltt-fs-events fs/read_write.c
--- 25/fs/read_write.c~ltt-fs-events	2005-01-23 19:12:01.774759952 -0800
+++ 25-akpm/fs/read_write.c	2005-01-23 19:12:01.788757824 -0800
@@ -15,6 +15,7 @@
 #include <linux/security.h>
 #include <linux/module.h>
 #include <linux/syscalls.h>
+#include <linux/ltt-events.h>
 
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
@@ -143,6 +144,9 @@ asmlinkage off_t sys_lseek(unsigned int 
 		if (res != (loff_t)retval)
 			retval = -EOVERFLOW;	/* LFS: should only happen on 32 bit platforms */
 	}
+
+	ltt_ev_file_system(LTT_EV_FILE_SYSTEM_SEEK, fd, offset, NULL);
+
 	fput_light(file, fput_needed);
 bad:
 	return retval;
@@ -170,6 +174,8 @@ asmlinkage long sys_llseek(unsigned int 
 	offset = vfs_llseek(file, ((loff_t) offset_high << 32) | offset_low,
 			origin);
 
+	ltt_ev_file_system(LTT_EV_FILE_SYSTEM_SEEK, fd, offset, NULL);
+
 	retval = (int)offset;
 	if (offset >= 0) {
 		retval = -EFAULT;
@@ -308,6 +314,7 @@ asmlinkage ssize_t sys_read(unsigned int
 	file = fget_light(fd, &fput_needed);
 	if (file) {
 		loff_t pos = file_pos_read(file);
+ 	 	ltt_ev_file_system(LTT_EV_FILE_SYSTEM_READ, fd, count, NULL);
 		ret = vfs_read(file, buf, count, &pos);
 		file_pos_write(file, pos);
 		fput_light(file, fput_needed);
@@ -326,6 +333,7 @@ asmlinkage ssize_t sys_write(unsigned in
 	file = fget_light(fd, &fput_needed);
 	if (file) {
 		loff_t pos = file_pos_read(file);
+		ltt_ev_file_system(LTT_EV_FILE_SYSTEM_WRITE, fd, count, NULL);
 		ret = vfs_write(file, buf, count, &pos);
 		file_pos_write(file, pos);
 		fput_light(file, fput_needed);
@@ -347,8 +355,11 @@ asmlinkage ssize_t sys_pread64(unsigned 
 	file = fget_light(fd, &fput_needed);
 	if (file) {
 		ret = -ESPIPE;
-		if (file->f_mode & FMODE_PREAD)
+		if (file->f_mode & FMODE_PREAD) {
+ 	 		ltt_ev_file_system(LTT_EV_FILE_SYSTEM_READ, fd, count, NULL);
 			ret = vfs_read(file, buf, count, &pos);
+		}
+
 		fput_light(file, fput_needed);
 	}
 
@@ -368,8 +379,10 @@ asmlinkage ssize_t sys_pwrite64(unsigned
 	file = fget_light(fd, &fput_needed);
 	if (file) {
 		ret = -ESPIPE;
-		if (file->f_mode & FMODE_PWRITE)  
+ 		if (file->f_mode & FMODE_PWRITE) {
+  			ltt_ev_file_system(LTT_EV_FILE_SYSTEM_WRITE, fd, count, NULL);
 			ret = vfs_write(file, buf, count, &pos);
+		}
 		fput_light(file, fput_needed);
 	}
 
@@ -560,6 +573,7 @@ sys_readv(unsigned long fd, const struct
 	file = fget_light(fd, &fput_needed);
 	if (file) {
 		loff_t pos = file_pos_read(file);
+ 		ltt_ev_file_system(LTT_EV_FILE_SYSTEM_READ, fd, vlen, NULL);
 		ret = vfs_readv(file, vec, vlen, &pos);
 		file_pos_write(file, pos);
 		fput_light(file, fput_needed);
@@ -581,6 +595,7 @@ sys_writev(unsigned long fd, const struc
 	file = fget_light(fd, &fput_needed);
 	if (file) {
 		loff_t pos = file_pos_read(file);
+	 	ltt_ev_file_system(LTT_EV_FILE_SYSTEM_WRITE, fd, vlen, NULL);
 		ret = vfs_writev(file, vec, vlen, &pos);
 		file_pos_write(file, pos);
 		fput_light(file, fput_needed);
diff -puN fs/relayfs/relay.c~ltt-fs-events fs/relayfs/relay.c
--- 25/fs/relayfs/relay.c~ltt-fs-events	2005-01-23 19:12:01.776759648 -0800
+++ 25-akpm/fs/relayfs/relay.c	2005-01-23 19:12:01.789757672 -0800
@@ -406,8 +406,7 @@ relay_mmap_region(struct vm_area_struct 
 
 	while (size > 0) {
 		page = kvirt_to_pa(pos);
-		if (remap_pfn_range(vma, start, page >> PAGE_SHIFT,
-					PAGE_SIZE, PAGE_SHARED))
+		if (remap_pfn_range(vma, start, page >> PAGE_SHIFT, PAGE_SIZE, PAGE_SHARED))
 			return -EAGAIN;
 		start += PAGE_SIZE;
 		pos += PAGE_SIZE;
diff -puN fs/select.c~ltt-fs-events fs/select.c
--- 25/fs/select.c~ltt-fs-events	2005-01-23 19:12:01.777759496 -0800
+++ 25-akpm/fs/select.c	2005-01-23 19:12:01.790757520 -0800
@@ -22,6 +22,7 @@
 #include <linux/personality.h> /* for STICKY_TIMEOUTS */
 #include <linux/file.h>
 #include <linux/fs.h>
+#include <linux/ltt-events.h>
 
 #include <asm/uaccess.h>
 
@@ -223,6 +224,8 @@ int do_select(int n, fd_set_bits *fds, l
 				file = fget(i);
 				if (file) {
 					f_op = file->f_op;
+					ltt_ev_file_system(LTT_EV_FILE_SYSTEM_SELECT, i /*  The fd*/,
+							__timeout, NULL);
 					mask = DEFAULT_POLLMASK;
 					if (f_op && f_op->poll)
 						mask = (*f_op->poll)(file, retval ? NULL : wait);
@@ -409,6 +412,7 @@ static void do_pollfd(unsigned int num, 
 			struct file * file = fget(fd);
 			mask = POLLNVAL;
 			if (file != NULL) {
+			        ltt_ev_file_system(LTT_EV_FILE_SYSTEM_POLL, fd, 0, NULL);
 				mask = DEFAULT_POLLMASK;
 				if (file->f_op && file->f_op->poll)
 					mask = file->f_op->poll(file, *pwait);
_