NFS: Use the dentry superblock directly in nfs_statfs()
authorDavid Howells <dhowells@redhat.com>
Wed, 23 Aug 2006 00:06:10 +0000 (20:06 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 23 Sep 2006 03:24:34 +0000 (23:24 -0400)
Use the nominated dentry's superblock directly in the NFS statfs() op to get a
file handle, rather than using s_root (which will become a dummy dentry in a
future patch).

Signed-Off-By: David Howells <dhowells@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/super.c

index f97d7d9..a41d516 100644 (file)
@@ -240,11 +240,10 @@ void __exit unregister_nfs_fs(void)
  */
 static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
-       struct super_block *sb = dentry->d_sb;
-       struct nfs_server *server = NFS_SB(sb);
+       struct nfs_server *server = NFS_SB(dentry->d_sb);
        unsigned char blockbits;
        unsigned long blockres;
-       struct nfs_fh *rootfh = NFS_FH(sb->s_root->d_inode);
+       struct nfs_fh *fh = NFS_FH(dentry->d_inode);
        struct nfs_fattr fattr;
        struct nfs_fsstat res = {
                        .fattr = &fattr,
@@ -253,7 +252,7 @@ static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 
        lock_kernel();
 
-       error = server->rpc_ops->statfs(server, rootfh, &res);
+       error = server->rpc_ops->statfs(server, fh, &res);
        buf->f_type = NFS_SUPER_MAGIC;
        if (error < 0)
                goto out_err;
@@ -263,7 +262,7 @@ static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
         * case where f_frsize != f_bsize.  Eventually we want to
         * report the value of wtmult in this field.
         */
-       buf->f_frsize = sb->s_blocksize;
+       buf->f_frsize = dentry->d_sb->s_blocksize;
 
        /*
         * On most *nix systems, f_blocks, f_bfree, and f_bavail
@@ -272,8 +271,8 @@ static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
         * thus historically Linux's sys_statfs reports these
         * fields in units of f_bsize.
         */
-       buf->f_bsize = sb->s_blocksize;
-       blockbits = sb->s_blocksize_bits;
+       buf->f_bsize = dentry->d_sb->s_blocksize;
+       blockbits = dentry->d_sb->s_blocksize_bits;
        blockres = (1 << blockbits) - 1;
        buf->f_blocks = (res.tbytes + blockres) >> blockbits;
        buf->f_bfree = (res.fbytes + blockres) >> blockbits;