2008-05-27 20:29:58

by Chuck Lever

[permalink] [raw]
Subject: [PATCH 3/7] NFS: Make nfs_open methods consistent

Clean up: Report the same debugging info and count function calls the
same for files and directories in nfs_opendir() and nfs_file_open().

Signed-off-by: Chuck Lever <[email protected]>
---

fs/nfs/dir.c | 8 ++++++--
fs/nfs/file.c | 5 +++++
2 files changed, 11 insertions(+), 2 deletions(-)


diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 36e51f7..40b559a 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -131,10 +131,14 @@ const struct inode_operations nfs4_dir_inode_operations = {
static int
nfs_opendir(struct inode *inode, struct file *filp)
{
+ struct dentry *dentry = filp->f_path.dentry;
int res;

- dfprintk(VFS, "NFS: opendir(%s/%ld)\n",
- inode->i_sb->s_id, inode->i_ino);
+ dfprintk(VFS, "NFS: open dir(%s/%s)\n",
+ dentry->d_parent->d_name.name,
+ dentry->d_name.name);
+
+ nfs_inc_stats(inode, NFSIOS_VFSOPEN);

lock_kernel();
/* Call generic open code in order to cache credentials */
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 06a1322..c3e7af0 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -117,8 +117,13 @@ static int nfs_check_flags(int flags)
static int
nfs_file_open(struct inode *inode, struct file *filp)
{
+ struct dentry *dentry = filp->f_path.dentry;
int res;

+ dfprintk(VFS, "NFS: open file(%s/%s)\n",
+ dentry->d_parent->d_name.name,
+ dentry->d_name.name);
+
res = nfs_check_flags(filp->f_flags);
if (res)
return res;



2008-06-10 18:27:46

by Myklebust, Trond

[permalink] [raw]
Subject: Re: [PATCH 3/7] NFS: Make nfs_open methods consistent

On Tue, 2008-05-27 at 16:29 -0400, Chuck Lever wrote:
> Clean up: Report the same debugging info and count function calls the
> same for files and directories in nfs_opendir() and nfs_file_open().
>=20
> Signed-off-by: Chuck Lever <[email protected]>
> ---
>=20
> fs/nfs/dir.c | 8 ++++++--
> fs/nfs/file.c | 5 +++++
> 2 files changed, 11 insertions(+), 2 deletions(-)
>=20
>=20
> diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
> index 36e51f7..40b559a 100644
> --- a/fs/nfs/dir.c
> +++ b/fs/nfs/dir.c
> @@ -131,10 +131,14 @@ const struct inode_operations nfs4_dir_inode_op=
erations =3D {
> static int
> nfs_opendir(struct inode *inode, struct file *filp)
> {
> + struct dentry *dentry =3D filp->f_path.dentry;
> int res;
> =20
> - dfprintk(VFS, "NFS: opendir(%s/%ld)\n",
> - inode->i_sb->s_id, inode->i_ino);
> + dfprintk(VFS, "NFS: open dir(%s/%s)\n",
> + dentry->d_parent->d_name.name,
> + dentry->d_name.name);
> +
> + nfs_inc_stats(inode, NFSIOS_VFSOPEN);
> =20

This will result in 'unused variable' warnings for 'dentry' if you
compile with #undef RPC_DEBUG.

> lock_kernel();
> /* Call generic open code in order to cache credentials */
> diff --git a/fs/nfs/file.c b/fs/nfs/file.c
> index 06a1322..c3e7af0 100644
> --- a/fs/nfs/file.c
> +++ b/fs/nfs/file.c
> @@ -117,8 +117,13 @@ static int nfs_check_flags(int flags)
> static int
> nfs_file_open(struct inode *inode, struct file *filp)
> {
> + struct dentry *dentry =3D filp->f_path.dentry;
> int res;
> =20
> + dfprintk(VFS, "NFS: open file(%s/%s)\n",
> + dentry->d_parent->d_name.name,
> + dentry->d_name.name);
> +

=EF=BB=BFThis will result in 'unused variable' warnings for 'dentry' if=
you
compile with #undef RPC_DEBUG.

> res =3D nfs_check_flags(filp->f_flags);
> if (res)
> return res;
>=20
--=20
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
http://www.netapp.com