NFS: Proper accounting for NFS VFS calls
authorChuck Lever <chuck.lever@oracle.com>
Mon, 1 Feb 2010 19:17:14 +0000 (14:17 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 10 Feb 2010 13:31:02 +0000 (08:31 -0500)
Nit: The VFSOPEN and VFSFLUSH counters are function call counters.
Count every call to these routines.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/file.c

index 63f2071d6445784899985823cb416dc9861351b7..57cf94f129ba883ec31685f5b74edb20a22c310c 100644 (file)
@@ -123,11 +123,11 @@ nfs_file_open(struct inode *inode, struct file *filp)
                        filp->f_path.dentry->d_parent->d_name.name,
                        filp->f_path.dentry->d_name.name);
 
+       nfs_inc_stats(inode, NFSIOS_VFSOPEN);
        res = nfs_check_flags(filp->f_flags);
        if (res)
                return res;
 
-       nfs_inc_stats(inode, NFSIOS_VFSOPEN);
        res = nfs_open(inode, filp);
        return res;
 }
@@ -237,9 +237,9 @@ nfs_file_flush(struct file *file, fl_owner_t id)
                        dentry->d_parent->d_name.name,
                        dentry->d_name.name);
 
+       nfs_inc_stats(inode, NFSIOS_VFSFLUSH);
        if ((file->f_mode & FMODE_WRITE) == 0)
                return 0;
-       nfs_inc_stats(inode, NFSIOS_VFSFLUSH);
 
        /* Flush writes to the server and return any errors */
        return nfs_do_fsync(ctx, inode);