aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-08-22 20:06:10 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-09-22 23:24:34 -0400
commit0c7d90cfed91a283228017ba6faf37ee0bcd32b1 (patch)
treebf8aae1186e905660f179cbda720ce51d1b7498c
parent24c8dbbb5f777187d660393599641ab3307b4b97 (diff)
NFS: Use the dentry superblock directly in nfs_statfs()
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>
-rw-r--r--fs/nfs/super.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index f97d7d9c5c32..a41d516ed595 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -240,11 +240,10 @@ void __exit unregister_nfs_fs(void)
240 */ 240 */
241static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf) 241static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
242{ 242{
243 struct super_block *sb = dentry->d_sb; 243 struct nfs_server *server = NFS_SB(dentry->d_sb);
244 struct nfs_server *server = NFS_SB(sb);
245 unsigned char blockbits; 244 unsigned char blockbits;
246 unsigned long blockres; 245 unsigned long blockres;
247 struct nfs_fh *rootfh = NFS_FH(sb->s_root->d_inode); 246 struct nfs_fh *fh = NFS_FH(dentry->d_inode);
248 struct nfs_fattr fattr; 247 struct nfs_fattr fattr;
249 struct nfs_fsstat res = { 248 struct nfs_fsstat res = {
250 .fattr = &fattr, 249 .fattr = &fattr,
@@ -253,7 +252,7 @@ static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
253 252
254 lock_kernel(); 253 lock_kernel();
255 254
256 error = server->rpc_ops->statfs(server, rootfh, &res); 255 error = server->rpc_ops->statfs(server, fh, &res);
257 buf->f_type = NFS_SUPER_MAGIC; 256 buf->f_type = NFS_SUPER_MAGIC;
258 if (error < 0) 257 if (error < 0)
259 goto out_err; 258 goto out_err;
@@ -263,7 +262,7 @@ static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
263 * case where f_frsize != f_bsize. Eventually we want to 262 * case where f_frsize != f_bsize. Eventually we want to
264 * report the value of wtmult in this field. 263 * report the value of wtmult in this field.
265 */ 264 */
266 buf->f_frsize = sb->s_blocksize; 265 buf->f_frsize = dentry->d_sb->s_blocksize;
267 266
268 /* 267 /*
269 * On most *nix systems, f_blocks, f_bfree, and f_bavail 268 * 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)
272 * thus historically Linux's sys_statfs reports these 271 * thus historically Linux's sys_statfs reports these
273 * fields in units of f_bsize. 272 * fields in units of f_bsize.
274 */ 273 */
275 buf->f_bsize = sb->s_blocksize; 274 buf->f_bsize = dentry->d_sb->s_blocksize;
276 blockbits = sb->s_blocksize_bits; 275 blockbits = dentry->d_sb->s_blocksize_bits;
277 blockres = (1 << blockbits) - 1; 276 blockres = (1 << blockbits) - 1;
278 buf->f_blocks = (res.tbytes + blockres) >> blockbits; 277 buf->f_blocks = (res.tbytes + blockres) >> blockbits;
279 buf->f_bfree = (res.fbytes + blockres) >> blockbits; 278 buf->f_bfree = (res.fbytes + blockres) >> blockbits;