public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [FS] Why doesn't this patch work?
@ 2001-12-05 23:28 Simon Kirby
  2001-12-05 23:46 ` Robert Love
  2001-12-05 23:52 ` Dave Jones
  0 siblings, 2 replies; 4+ messages in thread
From: Simon Kirby @ 2001-12-05 23:28 UTC (permalink / raw)
  To: linux-kernel, Alexander Viro

I'm attempting to write this little dinky patch to see who calls fsync()
or fdatasync(), but it's spitting out compiler warnings.  I can't figure
out why, though.  What did I do wrong?

buffer.c: In function `report_culprit':
buffer.c:409: warning: assignment from incompatible pointer type
buffer.c:410: warning: passing arg 2 of `d_path' from incompatible pointer type
buffer.c:420: warning: passing arg 1 of `mntput' from incompatible pointer type

--- linux/fs/buffer.c.orig	Wed Dec  5 08:53:28 2001
+++ linux/fs/buffer.c	Wed Dec  5 15:14:38 2001
@@ -396,6 +396,30 @@
 	return ret;
 }
 
+static void report_culprit(struct dentry *dentry, struct file *file, char *action)
+{
+	struct vfsmnt * mnt;
+	char * buf = (char*)__get_free_page(GFP_KERNEL);
+	char * path;
+	int len;
+
+	if (!buf)
+		return;
+
+	mnt = mntget(file->f_vfsmnt);
+	path = d_path(dentry, mnt, buf, PAGE_SIZE - 1);
+	len = buf + PAGE_SIZE - 1 - path;
+	if (len >= PAGE_SIZE - 1)
+		len = PAGE_SIZE - 1;
+	path[len] = '\0';
+
+	printk("Process %u (%s) %s()ed \"%s\".\n",
+		current->pid, current->comm, action, path);
+
+	free_page((unsigned long)buf);
+	mntput(mnt);
+}
+
 asmlinkage long sys_fsync(unsigned int fd)
 {
 	struct file * file;
@@ -415,6 +439,8 @@
 	if (!file->f_op || !file->f_op->fsync)
 		goto out_putf;
 
+	report_culprit(dentry, file, "fsync");
+
 	/* We need to protect against concurrent writers.. */
 	down(&inode->i_sem);
 	filemap_fdatasync(inode->i_mapping);
@@ -446,6 +472,8 @@
 	err = -EINVAL;
 	if (!file->f_op || !file->f_op->fsync)
 		goto out_putf;
+
+	report_culprit(dentry, file, "fdatasync");
 
 	down(&inode->i_sem);
 	filemap_fdatasync(inode->i_mapping);

Simon-

[  Stormix Technologies Inc.  ][  NetNation Communications Inc. ]
[       sim@stormix.com       ][       sim@netnation.com        ]
[ Opinions expressed are not necessarily those of my employers. ]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FS] Why doesn't this patch work?
  2001-12-05 23:28 [FS] Why doesn't this patch work? Simon Kirby
@ 2001-12-05 23:46 ` Robert Love
  2001-12-06  0:08   ` Simon Kirby
  2001-12-05 23:52 ` Dave Jones
  1 sibling, 1 reply; 4+ messages in thread
From: Robert Love @ 2001-12-05 23:46 UTC (permalink / raw)
  To: Simon Kirby; +Cc: linux-kernel, Alexander Viro

On Wed, 2001-12-05 at 18:28, Simon Kirby wrote:
> I'm attempting to write this little dinky patch to see who calls fsync()
> or fdatasync(), but it's spitting out compiler warnings.  I can't figure
> out why, though.  What did I do wrong?
> 
> buffer.c: In function `report_culprit':
> buffer.c:409: warning: assignment from incompatible pointer type
> buffer.c:410: warning: passing arg 2 of `d_path' from incompatible pointer type
> buffer.c:420: warning: passing arg 1 of `mntput' from incompatible pointer type

s/struct vfsmnt/struct vfsmount/

	Robert Love


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FS] Why doesn't this patch work?
  2001-12-05 23:28 [FS] Why doesn't this patch work? Simon Kirby
  2001-12-05 23:46 ` Robert Love
@ 2001-12-05 23:52 ` Dave Jones
  1 sibling, 0 replies; 4+ messages in thread
From: Dave Jones @ 2001-12-05 23:52 UTC (permalink / raw)
  To: Simon Kirby; +Cc: Linux Kernel Mailing List

On Wed, 5 Dec 2001, Simon Kirby wrote:

> buffer.c:409: warning: assignment from incompatible pointer type

> +	struct vfsmnt * mnt;

vfsmount perhaps ?

Dave.

-- 
| Dave Jones.        http://www.codemonkey.org.uk
| SuSE Labs


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FS] Why doesn't this patch work?
  2001-12-05 23:46 ` Robert Love
@ 2001-12-06  0:08   ` Simon Kirby
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Kirby @ 2001-12-06  0:08 UTC (permalink / raw)
  To: linux-kernel

On Wed, Dec 05, 2001 at 06:46:21PM -0500, Robert Love wrote:

> On Wed, 2001-12-05 at 18:28, Simon Kirby wrote:
> > I'm attempting to write this little dinky patch to see who calls fsync()
> > or fdatasync(), but it's spitting out compiler warnings.  I can't figure
> > out why, though.  What did I do wrong?
> > 
> > buffer.c: In function `report_culprit':
> > buffer.c:409: warning: assignment from incompatible pointer type
> > buffer.c:410: warning: passing arg 2 of `d_path' from incompatible pointer type
> > buffer.c:420: warning: passing arg 1 of `mntput' from incompatible pointer type
> 
> s/struct vfsmnt/struct vfsmount/

Doh!

Simon-

[  Stormix Technologies Inc.  ][  NetNation Communications Inc. ]
[       sim@stormix.com       ][       sim@netnation.com        ]
[ Opinions expressed are not necessarily those of my employers. ]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-12-06  0:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-05 23:28 [FS] Why doesn't this patch work? Simon Kirby
2001-12-05 23:46 ` Robert Love
2001-12-06  0:08   ` Simon Kirby
2001-12-05 23:52 ` Dave Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox