aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-06-23 05:02:58 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 10:42:45 -0400
commit726c334223180e3c0197cc980a432681370d4baf (patch)
tree8327b354bb3dc959a6606051ae6f8d4d035e38a2
parent454e2398be9b9fa30433fccc548db34d19aa9958 (diff)
[PATCH] VFS: Permit filesystem to perform statfs with a known root dentry
Give the statfs superblock operation a dentry pointer rather than a superblock pointer. This complements the get_sb() patch. That reduced the significance of sb->s_root, allowing NFS to place a fake root there. However, NFS does require a dentry to use as a target for the statfs operation. This permits the root in the vfsmount to be used instead. linux/mount.h has been added where necessary to make allyesconfig build successfully. Interest has also been expressed for use with the FUSE and XFS filesystems. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Al Viro <viro@zeniv.linux.org.uk> Cc: Nathan Scott <nathans@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--Documentation/filesystems/Locking2
-rw-r--r--Documentation/filesystems/vfs.txt2
-rw-r--r--arch/alpha/kernel/osf_sys.c2
-rw-r--r--arch/mips/kernel/sysirix.c12
-rw-r--r--arch/parisc/hpux/sys_hpux.c10
-rw-r--r--arch/sparc64/solaris/fs.c4
-rw-r--r--fs/adfs/super.c8
-rw-r--r--fs/affs/super.c5
-rw-r--r--fs/befs/linuxvfs.c5
-rw-r--r--fs/bfs/inode.c3
-rw-r--r--fs/cifs/cifsfs.c3
-rw-r--r--fs/coda/inode.c6
-rw-r--r--fs/coda/upcall.c4
-rw-r--r--fs/compat.c8
-rw-r--r--fs/cramfs/inode.c4
-rw-r--r--fs/efs/super.c6
-rw-r--r--fs/ext2/super.c5
-rw-r--r--fs/ext3/super.c5
-rw-r--r--fs/fat/inode.c8
-rw-r--r--fs/freevxfs/vxfs_super.c13
-rw-r--r--fs/fuse/inode.c3
-rw-r--r--fs/hfs/super.c4
-rw-r--r--fs/hfsplus/super.c4
-rw-r--r--fs/hostfs/hostfs_kern.c4
-rw-r--r--fs/hpfs/super.c3
-rw-r--r--fs/hppfs/hppfs_kern.c2
-rw-r--r--fs/hugetlbfs/inode.c4
-rw-r--r--fs/isofs/inode.c6
-rw-r--r--fs/jffs/inode-v23.c4
-rw-r--r--fs/jffs2/fs.c4
-rw-r--r--fs/jffs2/os-linux.h2
-rw-r--r--fs/jfs/super.c4
-rw-r--r--fs/libfs.c4
-rw-r--r--fs/minix/inode.c10
-rw-r--r--fs/ncpfs/inode.c5
-rw-r--r--fs/nfs/inode.c5
-rw-r--r--fs/nfsd/nfs4xdr.c2
-rw-r--r--fs/nfsd/vfs.c2
-rw-r--r--fs/ntfs/super.c7
-rw-r--r--fs/ocfs2/super.c10
-rw-r--r--fs/open.c26
-rw-r--r--fs/qnx4/inode.c6
-rw-r--r--fs/reiserfs/super.c8
-rw-r--r--fs/romfs/inode.c4
-rw-r--r--fs/smbfs/inode.c6
-rw-r--r--fs/smbfs/proc.c4
-rw-r--r--fs/smbfs/proto.h2
-rw-r--r--fs/super.c2
-rw-r--r--fs/sysv/inode.c3
-rw-r--r--fs/udf/super.c6
-rw-r--r--fs/ufs/super.c3
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c4
-rw-r--r--include/linux/coda_psdev.h2
-rw-r--r--include/linux/fs.h6
-rw-r--r--include/linux/mount.h5
-rw-r--r--include/linux/security.h14
-rw-r--r--kernel/acct.c2
-rw-r--r--mm/shmem.c4
-rw-r--r--security/dummy.c2
-rw-r--r--security/selinux/hooks.c6
60 files changed, 175 insertions, 144 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index 3abf08f1b14a..d31efbbdfe50 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -99,7 +99,7 @@ prototypes:
99 int (*sync_fs)(struct super_block *sb, int wait); 99 int (*sync_fs)(struct super_block *sb, int wait);
100 void (*write_super_lockfs) (struct super_block *); 100 void (*write_super_lockfs) (struct super_block *);
101 void (*unlockfs) (struct super_block *); 101 void (*unlockfs) (struct super_block *);
102 int (*statfs) (struct super_block *, struct kstatfs *); 102 int (*statfs) (struct dentry *, struct kstatfs *);
103 int (*remount_fs) (struct super_block *, int *, char *); 103 int (*remount_fs) (struct super_block *, int *, char *);
104 void (*clear_inode) (struct inode *); 104 void (*clear_inode) (struct inode *);
105 void (*umount_begin) (struct super_block *); 105 void (*umount_begin) (struct super_block *);
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index dd7d0dcedc87..9d3aed628bc1 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -211,7 +211,7 @@ struct super_operations {
211 int (*sync_fs)(struct super_block *sb, int wait); 211 int (*sync_fs)(struct super_block *sb, int wait);
212 void (*write_super_lockfs) (struct super_block *); 212 void (*write_super_lockfs) (struct super_block *);
213 void (*unlockfs) (struct super_block *); 213 void (*unlockfs) (struct super_block *);
214 int (*statfs) (struct super_block *, struct kstatfs *); 214 int (*statfs) (struct dentry *, struct kstatfs *);
215 int (*remount_fs) (struct super_block *, int *, char *); 215 int (*remount_fs) (struct super_block *, int *, char *);
216 void (*clear_inode) (struct inode *); 216 void (*clear_inode) (struct inode *);
217 void (*umount_begin) (struct super_block *); 217 void (*umount_begin) (struct super_block *);
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 31afe3d91ac6..e15dcf4f3dcd 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -244,7 +244,7 @@ do_osf_statfs(struct dentry * dentry, struct osf_statfs __user *buffer,
244 unsigned long bufsiz) 244 unsigned long bufsiz)
245{ 245{
246 struct kstatfs linux_stat; 246 struct kstatfs linux_stat;
247 int error = vfs_statfs(dentry->d_inode->i_sb, &linux_stat); 247 int error = vfs_statfs(dentry, &linux_stat);
248 if (!error) 248 if (!error)
249 error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz); 249 error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz);
250 return error; 250 return error;
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index 5407b784cd01..19e1ef43eb4b 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -694,7 +694,7 @@ asmlinkage int irix_statfs(const char __user *path,
694 if (error) 694 if (error)
695 goto out; 695 goto out;
696 696
697 error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf); 697 error = vfs_statfs(nd.dentry, &kbuf);
698 if (error) 698 if (error)
699 goto dput_and_out; 699 goto dput_and_out;
700 700
@@ -732,7 +732,7 @@ asmlinkage int irix_fstatfs(unsigned int fd, struct irix_statfs __user *buf)
732 goto out; 732 goto out;
733 } 733 }
734 734
735 error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf); 735 error = vfs_statfs(file->f_dentry, &kbuf);
736 if (error) 736 if (error)
737 goto out_f; 737 goto out_f;
738 738
@@ -1360,7 +1360,7 @@ asmlinkage int irix_statvfs(char __user *fname, struct irix_statvfs __user *buf)
1360 error = user_path_walk(fname, &nd); 1360 error = user_path_walk(fname, &nd);
1361 if (error) 1361 if (error)
1362 goto out; 1362 goto out;
1363 error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf); 1363 error = vfs_statfs(nd.dentry, &kbuf);
1364 if (error) 1364 if (error)
1365 goto dput_and_out; 1365 goto dput_and_out;
1366 1366
@@ -1406,7 +1406,7 @@ asmlinkage int irix_fstatvfs(int fd, struct irix_statvfs __user *buf)
1406 error = -EBADF; 1406 error = -EBADF;
1407 goto out; 1407 goto out;
1408 } 1408 }
1409 error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf); 1409 error = vfs_statfs(file->f_dentry, &kbuf);
1410 if (error) 1410 if (error)
1411 goto out_f; 1411 goto out_f;
1412 1412
@@ -1611,7 +1611,7 @@ asmlinkage int irix_statvfs64(char __user *fname, struct irix_statvfs64 __user *
1611 error = user_path_walk(fname, &nd); 1611 error = user_path_walk(fname, &nd);
1612 if (error) 1612 if (error)
1613 goto out; 1613 goto out;
1614 error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf); 1614 error = vfs_statfs(nd.dentry, &kbuf);
1615 if (error) 1615 if (error)
1616 goto dput_and_out; 1616 goto dput_and_out;
1617 1617
@@ -1658,7 +1658,7 @@ asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs __user *buf)
1658 error = -EBADF; 1658 error = -EBADF;
1659 goto out; 1659 goto out;
1660 } 1660 }
1661 error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf); 1661 error = vfs_statfs(file->f_dentry, &kbuf);
1662 if (error) 1662 if (error)
1663 goto out_f; 1663 goto out_f;
1664 1664
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c
index 05273ccced0e..cb69727027ae 100644
--- a/arch/parisc/hpux/sys_hpux.c
+++ b/arch/parisc/hpux/sys_hpux.c
@@ -145,7 +145,7 @@ static int hpux_ustat(dev_t dev, struct hpux_ustat __user *ubuf)
145 s = user_get_super(dev); 145 s = user_get_super(dev);
146 if (s == NULL) 146 if (s == NULL)
147 goto out; 147 goto out;
148 err = vfs_statfs(s, &sbuf); 148 err = vfs_statfs(s->s_root, &sbuf);
149 drop_super(s); 149 drop_super(s);
150 if (err) 150 if (err)
151 goto out; 151 goto out;
@@ -186,12 +186,12 @@ struct hpux_statfs {
186 int16_t f_pad; 186 int16_t f_pad;
187}; 187};
188 188
189static int vfs_statfs_hpux(struct super_block *sb, struct hpux_statfs *buf) 189static int vfs_statfs_hpux(struct dentry *dentry, struct hpux_statfs *buf)
190{ 190{
191 struct kstatfs st; 191 struct kstatfs st;
192 int retval; 192 int retval;
193 193
194 retval = vfs_statfs(sb, &st); 194 retval = vfs_statfs(dentry, &st);
195 if (retval) 195 if (retval)
196 return retval; 196 return retval;
197 197
@@ -219,7 +219,7 @@ asmlinkage long hpux_statfs(const char __user *path,
219 error = user_path_walk(path, &nd); 219 error = user_path_walk(path, &nd);
220 if (!error) { 220 if (!error) {
221 struct hpux_statfs tmp; 221 struct hpux_statfs tmp;
222 error = vfs_statfs_hpux(nd.dentry->d_inode->i_sb, &tmp); 222 error = vfs_statfs_hpux(nd.dentry, &tmp);
223 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 223 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
224 error = -EFAULT; 224 error = -EFAULT;
225 path_release(&nd); 225 path_release(&nd);
@@ -237,7 +237,7 @@ asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf)
237 file = fget(fd); 237 file = fget(fd);
238 if (!file) 238 if (!file)
239 goto out; 239 goto out;
240 error = vfs_statfs_hpux(file->f_dentry->d_inode->i_sb, &tmp); 240 error = vfs_statfs_hpux(file->f_dentry, &tmp);
241 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 241 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
242 error = -EFAULT; 242 error = -EFAULT;
243 fput(file); 243 fput(file);
diff --git a/arch/sparc64/solaris/fs.c b/arch/sparc64/solaris/fs.c
index 4885ca6cbc77..0f0eb6aa1c40 100644
--- a/arch/sparc64/solaris/fs.c
+++ b/arch/sparc64/solaris/fs.c
@@ -356,7 +356,7 @@ static int report_statvfs(struct vfsmount *mnt, struct inode *inode, u32 buf)
356 int error; 356 int error;
357 struct sol_statvfs __user *ss = A(buf); 357 struct sol_statvfs __user *ss = A(buf);
358 358
359 error = vfs_statfs(mnt->mnt_sb, &s); 359 error = vfs_statfs(mnt->mnt_root, &s);
360 if (!error) { 360 if (!error) {
361 const char *p = mnt->mnt_sb->s_type->name; 361 const char *p = mnt->mnt_sb->s_type->name;
362 int i = 0; 362 int i = 0;
@@ -392,7 +392,7 @@ static int report_statvfs64(struct vfsmount *mnt, struct inode *inode, u32 buf)
392 int error; 392 int error;
393 struct sol_statvfs64 __user *ss = A(buf); 393 struct sol_statvfs64 __user *ss = A(buf);
394 394
395 error = vfs_statfs(mnt->mnt_sb, &s); 395 error = vfs_statfs(mnt->mnt_root, &s);
396 if (!error) { 396 if (!error) {
397 const char *p = mnt->mnt_sb->s_type->name; 397 const char *p = mnt->mnt_sb->s_type->name;
398 int i = 0; 398 int i = 0;
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index 1b58a9b7f6aa..ba1c88af49fe 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -196,17 +196,17 @@ static int adfs_remount(struct super_block *sb, int *flags, char *data)
196 return parse_options(sb, data); 196 return parse_options(sb, data);
197} 197}
198 198
199static int adfs_statfs(struct super_block *sb, struct kstatfs *buf) 199static int adfs_statfs(struct dentry *dentry, struct kstatfs *buf)
200{ 200{
201 struct adfs_sb_info *asb = ADFS_SB(sb); 201 struct adfs_sb_info *asb = ADFS_SB(dentry->d_sb);
202 202
203 buf->f_type = ADFS_SUPER_MAGIC; 203 buf->f_type = ADFS_SUPER_MAGIC;
204 buf->f_namelen = asb->s_namelen; 204 buf->f_namelen = asb->s_namelen;
205 buf->f_bsize = sb->s_blocksize; 205 buf->f_bsize = dentry->d_sb->s_blocksize;
206 buf->f_blocks = asb->s_size; 206 buf->f_blocks = asb->s_size;
207 buf->f_files = asb->s_ids_per_zone * asb->s_map_size; 207 buf->f_files = asb->s_ids_per_zone * asb->s_map_size;
208 buf->f_bavail = 208 buf->f_bavail =
209 buf->f_bfree = adfs_map_free(sb); 209 buf->f_bfree = adfs_map_free(dentry->d_sb);
210 buf->f_ffree = (long)(buf->f_bfree * buf->f_files) / (long)buf->f_blocks; 210 buf->f_ffree = (long)(buf->f_bfree * buf->f_files) / (long)buf->f_blocks;
211 211
212 return 0; 212 return 0;
diff --git a/fs/affs/super.c b/fs/affs/super.c
index 6a52e7875403..8765cba35bb9 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -18,7 +18,7 @@
18 18
19extern struct timezone sys_tz; 19extern struct timezone sys_tz;
20 20
21static int affs_statfs(struct super_block *sb, struct kstatfs *buf); 21static int affs_statfs(struct dentry *dentry, struct kstatfs *buf);
22static int affs_remount (struct super_block *sb, int *flags, char *data); 22static int affs_remount (struct super_block *sb, int *flags, char *data);
23 23
24static void 24static void
@@ -508,8 +508,9 @@ affs_remount(struct super_block *sb, int *flags, char *data)
508} 508}
509 509
510static int 510static int
511affs_statfs(struct super_block *sb, struct kstatfs *buf) 511affs_statfs(struct dentry *dentry, struct kstatfs *buf)
512{ 512{
513 struct super_block *sb = dentry->d_sb;
513 int free; 514 int free;
514 515
515 pr_debug("AFFS: statfs() partsize=%d, reserved=%d\n",AFFS_SB(sb)->s_partition_size, 516 pr_debug("AFFS: statfs() partsize=%d, reserved=%d\n",AFFS_SB(sb)->s_partition_size,
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 6ed07a5f10c6..08201fab26cd 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -49,7 +49,7 @@ static int befs_nls2utf(struct super_block *sb, const char *in, int in_len,
49 char **out, int *out_len); 49 char **out, int *out_len);
50static void befs_put_super(struct super_block *); 50static void befs_put_super(struct super_block *);
51static int befs_remount(struct super_block *, int *, char *); 51static int befs_remount(struct super_block *, int *, char *);
52static int befs_statfs(struct super_block *, struct kstatfs *); 52static int befs_statfs(struct dentry *, struct kstatfs *);
53static int parse_options(char *, befs_mount_options *); 53static int parse_options(char *, befs_mount_options *);
54 54
55static const struct super_operations befs_sops = { 55static const struct super_operations befs_sops = {
@@ -880,8 +880,9 @@ befs_remount(struct super_block *sb, int *flags, char *data)
880} 880}
881 881
882static int 882static int
883befs_statfs(struct super_block *sb, struct kstatfs *buf) 883befs_statfs(struct dentry *dentry, struct kstatfs *buf)
884{ 884{
885 struct super_block *sb = dentry->d_sb;
885 886
886 befs_debug(sb, "---> befs_statfs()"); 887 befs_debug(sb, "---> befs_statfs()");
887 888
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index e7da03f63a5a..cf74f3d4d966 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -203,8 +203,9 @@ static void bfs_put_super(struct super_block *s)
203 s->s_fs_info = NULL; 203 s->s_fs_info = NULL;
204} 204}
205 205
206static int bfs_statfs(struct super_block *s, struct kstatfs *buf) 206static int bfs_statfs(struct dentry *dentry, struct kstatfs *buf)
207{ 207{
208 struct super_block *s = dentry->d_sb;
208 struct bfs_sb_info *info = BFS_SB(s); 209 struct bfs_sb_info *info = BFS_SB(s);
209 u64 id = huge_encode_dev(s->s_bdev->bd_dev); 210 u64 id = huge_encode_dev(s->s_bdev->bd_dev);
210 buf->f_type = BFS_MAGIC; 211 buf->f_type = BFS_MAGIC;
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 08b35801dfed..7520f4687158 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -166,8 +166,9 @@ cifs_put_super(struct super_block *sb)
166} 166}
167 167
168static int 168static int
169cifs_statfs(struct super_block *sb, struct kstatfs *buf) 169cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
170{ 170{
171 struct super_block *sb = dentry->d_sb;
171 int xid; 172 int xid;
172 int rc = -EOPNOTSUPP; 173 int rc = -EOPNOTSUPP;
173 struct cifs_sb_info *cifs_sb; 174 struct cifs_sb_info *cifs_sb;
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index cba70201567d..87f1dc8aa24b 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -36,7 +36,7 @@
36/* VFS super_block ops */ 36/* VFS super_block ops */
37static void coda_clear_inode(struct inode *); 37static void coda_clear_inode(struct inode *);
38static void coda_put_super(struct super_block *); 38static void coda_put_super(struct super_block *);
39static int coda_statfs(struct super_block *sb, struct kstatfs *buf); 39static int coda_statfs(struct dentry *dentry, struct kstatfs *buf);
40 40
41static kmem_cache_t * coda_inode_cachep; 41static kmem_cache_t * coda_inode_cachep;
42 42
@@ -278,13 +278,13 @@ struct inode_operations coda_file_inode_operations = {
278 .setattr = coda_setattr, 278 .setattr = coda_setattr,
279}; 279};
280 280
281static int coda_statfs(struct super_block *sb, struct kstatfs *buf) 281static int coda_statfs(struct dentry *dentry, struct kstatfs *buf)
282{ 282{
283 int error; 283 int error;
284 284
285 lock_kernel(); 285 lock_kernel();
286 286
287 error = venus_statfs(sb, buf); 287 error = venus_statfs(dentry, buf);
288 288
289 unlock_kernel(); 289 unlock_kernel();
290 290
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c
index 1bae99650a91..b040eba13a7d 100644
--- a/fs/coda/upcall.c
+++ b/fs/coda/upcall.c
@@ -611,7 +611,7 @@ int venus_pioctl(struct super_block *sb, struct CodaFid *fid,
611 return error; 611 return error;
612} 612}
613 613
614int venus_statfs(struct super_block *sb, struct kstatfs *sfs) 614int venus_statfs(struct dentry *dentry, struct kstatfs *sfs)
615{ 615{
616 union inputArgs *inp; 616 union inputArgs *inp;
617 union outputArgs *outp; 617 union outputArgs *outp;
@@ -620,7 +620,7 @@ int venus_statfs(struct super_block *sb, struct kstatfs *sfs)
620 insize = max_t(unsigned int, INSIZE(statfs), OUTSIZE(statfs)); 620 insize = max_t(unsigned int, INSIZE(statfs), OUTSIZE(statfs));
621 UPARG(CODA_STATFS); 621 UPARG(CODA_STATFS);
622 622
623 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 623 error = coda_upcall(coda_sbp(dentry->d_sb), insize, &outsize, inp);
624 624
625 if (!error) { 625 if (!error) {
626 sfs->f_blocks = outp->coda_statfs.stat.f_blocks; 626 sfs->f_blocks = outp->coda_statfs.stat.f_blocks;
diff --git a/fs/compat.c b/fs/compat.c
index b1f64786a613..7e7e5bc4f3cf 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -197,7 +197,7 @@ asmlinkage long compat_sys_statfs(const char __user *path, struct compat_statfs
197 error = user_path_walk(path, &nd); 197 error = user_path_walk(path, &nd);
198 if (!error) { 198 if (!error) {
199 struct kstatfs tmp; 199 struct kstatfs tmp;
200 error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp); 200 error = vfs_statfs(nd.dentry, &tmp);
201 if (!error) 201 if (!error)
202 error = put_compat_statfs(buf, &tmp); 202 error = put_compat_statfs(buf, &tmp);
203 path_release(&nd); 203 path_release(&nd);
@@ -215,7 +215,7 @@ asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user
215 file = fget(fd); 215 file = fget(fd);
216 if (!file) 216 if (!file)
217 goto out; 217 goto out;
218 error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp); 218 error = vfs_statfs(file->f_dentry, &tmp);
219 if (!error) 219 if (!error)
220 error = put_compat_statfs(buf, &tmp); 220 error = put_compat_statfs(buf, &tmp);
221 fput(file); 221 fput(file);
@@ -265,7 +265,7 @@ asmlinkage long compat_sys_statfs64(const char __user *path, compat_size_t sz, s
265 error = user_path_walk(path, &nd); 265 error = user_path_walk(path, &nd);
266 if (!error) { 266 if (!error) {
267 struct kstatfs tmp; 267 struct kstatfs tmp;
268 error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp); 268 error = vfs_statfs(nd.dentry, &tmp);
269 if (!error) 269 if (!error)
270 error = put_compat_statfs64(buf, &tmp); 270 error = put_compat_statfs64(buf, &tmp);
271 path_release(&nd); 271 path_release(&nd);
@@ -286,7 +286,7 @@ asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct c
286 file = fget(fd); 286 file = fget(fd);
287 if (!file) 287 if (!file)
288 goto out; 288 goto out;
289 error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp); 289 error = vfs_statfs(file->f_dentry, &tmp);
290 if (!error) 290 if (!error)
291 error = put_compat_statfs64(buf, &tmp); 291 error = put_compat_statfs64(buf, &tmp);
292 fput(file); 292 fput(file);
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 37a91a153aa5..8a9d5d3b3262 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -322,8 +322,10 @@ out:
322 return -EINVAL; 322 return -EINVAL;
323} 323}
324 324
325static int cramfs_statfs(struct super_block *sb, struct kstatfs *buf) 325static int cramfs_statfs(struct dentry *dentry, struct kstatfs *buf)
326{ 326{
327 struct super_block *sb = dentry->d_sb;
328
327 buf->f_type = CRAMFS_MAGIC; 329 buf->f_type = CRAMFS_MAGIC;
328 buf->f_bsize = PAGE_CACHE_SIZE; 330 buf->f_bsize = PAGE_CACHE_SIZE;
329 buf->f_blocks = CRAMFS_SB(sb)->blocks; 331 buf->f_blocks = CRAMFS_SB(sb)->blocks;
diff --git a/fs/efs/super.c b/fs/efs/super.c
index 1ba5e14f879f..8ac2462ae5dd 100644
--- a/fs/efs/super.c
+++ b/fs/efs/super.c
@@ -15,7 +15,7 @@
15#include <linux/buffer_head.h> 15#include <linux/buffer_head.h>
16#include <linux/vfs.h> 16#include <linux/vfs.h>
17 17
18static int efs_statfs(struct super_block *s, struct kstatfs *buf); 18static int efs_statfs(struct dentry *dentry, struct kstatfs *buf);
19static int efs_fill_super(struct super_block *s, void *d, int silent); 19static int efs_fill_super(struct super_block *s, void *d, int silent);
20 20
21static int efs_get_sb(struct file_system_type *fs_type, 21static int efs_get_sb(struct file_system_type *fs_type,
@@ -322,8 +322,8 @@ out_no_fs:
322 return -EINVAL; 322 return -EINVAL;
323} 323}
324 324
325static int efs_statfs(struct super_block *s, struct kstatfs *buf) { 325static int efs_statfs(struct dentry *dentry, struct kstatfs *buf) {
326 struct efs_sb_info *sb = SUPER_INFO(s); 326 struct efs_sb_info *sb = SUPER_INFO(dentry->d_sb);
327 327
328 buf->f_type = EFS_SUPER_MAGIC; /* efs magic number */ 328 buf->f_type = EFS_SUPER_MAGIC; /* efs magic number */
329 buf->f_bsize = EFS_BLOCKSIZE; /* blocksize */ 329 buf->f_bsize = EFS_BLOCKSIZE; /* blocksize */
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index a4dfffac5967..a6c4d6e02324 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -39,7 +39,7 @@
39static void ext2_sync_super(struct super_block *sb, 39static void ext2_sync_super(struct super_block *sb,
40 struct ext2_super_block *es); 40 struct ext2_super_block *es);
41static int ext2_remount (struct super_block * sb, int * flags, char * data); 41static int ext2_remount (struct super_block * sb, int * flags, char * data);
42static int ext2_statfs (struct super_block * sb, struct kstatfs * buf); 42static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf);
43 43
44void ext2_error (struct super_block * sb, const char * function, 44void ext2_error (struct super_block * sb, const char * function,
45 const char * fmt, ...) 45 const char * fmt, ...)
@@ -1038,8 +1038,9 @@ restore_opts:
1038 return err; 1038 return err;
1039} 1039}
1040 1040
1041static int ext2_statfs (struct super_block * sb, struct kstatfs * buf) 1041static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf)
1042{ 1042{
1043 struct super_block *sb = dentry->d_sb;
1043 struct ext2_sb_info *sbi = EXT2_SB(sb); 1044 struct ext2_sb_info *sbi = EXT2_SB(sb);
1044 unsigned long overhead; 1045 unsigned long overhead;
1045 int i; 1046 int i;
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 657f8e73b62f..e08b6439617c 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -58,7 +58,7 @@ static int ext3_sync_fs(struct super_block *sb, int wait);
58static const char *ext3_decode_error(struct super_block * sb, int errno, 58static const char *ext3_decode_error(struct super_block * sb, int errno,
59 char nbuf[16]); 59 char nbuf[16]);
60static int ext3_remount (struct super_block * sb, int * flags, char * data); 60static int ext3_remount (struct super_block * sb, int * flags, char * data);
61static int ext3_statfs (struct super_block * sb, struct kstatfs * buf); 61static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf);
62static void ext3_unlockfs(struct super_block *sb); 62static void ext3_unlockfs(struct super_block *sb);
63static void ext3_write_super (struct super_block * sb); 63static void ext3_write_super (struct super_block * sb);
64static void ext3_write_super_lockfs(struct super_block *sb); 64static void ext3_write_super_lockfs(struct super_block *sb);
@@ -2318,8 +2318,9 @@ restore_opts:
2318 return err; 2318 return err;
2319} 2319}
2320 2320
2321static int ext3_statfs (struct super_block * sb, struct kstatfs * buf) 2321static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf)
2322{ 2322{
2323 struct super_block *sb = dentry->d_sb;
2323 struct ext3_sb_info *sbi = EXT3_SB(sb); 2324 struct ext3_sb_info *sbi = EXT3_SB(sb);
2324 struct ext3_super_block *es = sbi->s_es; 2325 struct ext3_super_block *es = sbi->s_es;
2325 unsigned long overhead; 2326 unsigned long overhead;
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index c1ce284f8a94..7c35d582ec10 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -539,18 +539,18 @@ static int fat_remount(struct super_block *sb, int *flags, char *data)
539 return 0; 539 return 0;
540} 540}
541 541
542static int fat_statfs(struct super_block *sb, struct kstatfs *buf) 542static int fat_statfs(struct dentry *dentry, struct kstatfs *buf)
543{ 543{
544 struct msdos_sb_info *sbi = MSDOS_SB(sb); 544 struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb);
545 545
546 /* If the count of free cluster is still unknown, counts it here. */ 546 /* If the count of free cluster is still unknown, counts it here. */
547 if (sbi->free_clusters == -1) { 547 if (sbi->free_clusters == -1) {
548 int err = fat_count_free_clusters(sb); 548 int err = fat_count_free_clusters(dentry->d_sb);
549 if (err) 549 if (err)
550 return err; 550 return err;
551 } 551 }
552 552
553 buf->f_type = sb->s_magic; 553 buf->f_type = dentry->d_sb->s_magic;
554 buf->f_bsize = sbi->cluster_size; 554 buf->f_bsize = sbi->cluster_size;
555 buf->f_blocks = sbi->max_cluster - FAT_START_ENT; 555 buf->f_blocks = sbi->max_cluster - FAT_START_ENT;
556 buf->f_bfree = sbi->free_clusters; 556 buf->f_bfree = sbi->free_clusters;
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c
index d76eeaafbde2..b74b791fc23b 100644
--- a/fs/freevxfs/vxfs_super.c
+++ b/fs/freevxfs/vxfs_super.c
@@ -40,6 +40,7 @@
40#include <linux/slab.h> 40#include <linux/slab.h>
41#include <linux/stat.h> 41#include <linux/stat.h>
42#include <linux/vfs.h> 42#include <linux/vfs.h>
43#include <linux/mount.h>
43 44
44#include "vxfs.h" 45#include "vxfs.h"
45#include "vxfs_extern.h" 46#include "vxfs_extern.h"
@@ -55,7 +56,7 @@ MODULE_ALIAS("vxfs"); /* makes mount -t vxfs autoload the module */
55 56
56 57
57static void vxfs_put_super(struct super_block *); 58static void vxfs_put_super(struct super_block *);
58static int vxfs_statfs(struct super_block *, struct kstatfs *); 59static int vxfs_statfs(struct dentry *, struct kstatfs *);
59static int vxfs_remount(struct super_block *, int *, char *); 60static int vxfs_remount(struct super_block *, int *, char *);
60 61
61static struct super_operations vxfs_super_ops = { 62static struct super_operations vxfs_super_ops = {
@@ -90,12 +91,12 @@ vxfs_put_super(struct super_block *sbp)
90 91
91/** 92/**
92 * vxfs_statfs - get filesystem information 93 * vxfs_statfs - get filesystem information
93 * @sbp: VFS superblock 94 * @dentry: VFS dentry to locate superblock
94 * @bufp: output buffer 95 * @bufp: output buffer
95 * 96 *
96 * Description: 97 * Description:
97 * vxfs_statfs fills the statfs buffer @bufp with information 98 * vxfs_statfs fills the statfs buffer @bufp with information
98 * about the filesystem described by @sbp. 99 * about the filesystem described by @dentry.
99 * 100 *
100 * Returns: 101 * Returns:
101 * Zero. 102 * Zero.
@@ -107,12 +108,12 @@ vxfs_put_super(struct super_block *sbp)
107 * This is everything but complete... 108 * This is everything but complete...
108 */ 109 */
109static int 110static int
110vxfs_statfs(struct super_block *sbp, struct kstatfs *bufp) 111vxfs_statfs(struct dentry *dentry, struct kstatfs *bufp)
111{ 112{
112 struct vxfs_sb_info *infp = VXFS_SBI(sbp); 113 struct vxfs_sb_info *infp = VXFS_SBI(dentry->d_sb);
113 114
114 bufp->f_type = VXFS_SUPER_MAGIC; 115 bufp->f_type = VXFS_SUPER_MAGIC;
115 bufp->f_bsize = sbp->s_blocksize; 116 bufp->f_bsize = dentry->d_sb->s_blocksize;
116 bufp->f_blocks = infp->vsi_raw->vs_dsize; 117 bufp->f_blocks = infp->vsi_raw->vs_dsize;
117 bufp->f_bfree = infp->vsi_raw->vs_free; 118 bufp->f_bfree = infp->vsi_raw->vs_free;
118 bufp->f_bavail = 0; 119 bufp->f_bavail = 0;
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index c91f0a50aadb..a13c0f529058 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -236,8 +236,9 @@ static void convert_fuse_statfs(struct kstatfs *stbuf, struct fuse_kstatfs *attr
236 /* fsid is left zero */ 236 /* fsid is left zero */
237} 237}
238 238
239static int fuse_statfs(struct super_block *sb, struct kstatfs *buf) 239static int fuse_statfs(struct dentry *dentry, struct kstatfs *buf)
240{ 240{
241 struct super_block *sb = dentry->d_sb;
241 struct fuse_conn *fc = get_fuse_conn_super(sb); 242 struct fuse_conn *fc = get_fuse_conn_super(sb);
242 struct fuse_req *req; 243 struct fuse_req *req;
243 struct fuse_statfs_out outarg; 244 struct fuse_statfs_out outarg;
diff --git a/fs/hfs/super.c b/fs/hfs/super.c
index ee5b80a409e8..d9227bf14e86 100644
--- a/fs/hfs/super.c
+++ b/fs/hfs/super.c
@@ -80,8 +80,10 @@ static void hfs_put_super(struct super_block *sb)
80 * 80 *
81 * changed f_files/f_ffree to reflect the fs_ablock/free_ablocks. 81 * changed f_files/f_ffree to reflect the fs_ablock/free_ablocks.
82 */ 82 */
83static int hfs_statfs(struct super_block *sb, struct kstatfs *buf) 83static int hfs_statfs(struct dentry *dentry, struct kstatfs *buf)
84{ 84{
85 struct super_block *sb = dentry->d_sb;
86
85 buf->f_type = HFS_SUPER_MAGIC; 87 buf->f_type = HFS_SUPER_MAGIC;
86 buf->f_bsize = sb->s_blocksize; 88 buf->f_bsize = sb->s_blocksize;
87 buf->f_blocks = (u32)HFS_SB(sb)->fs_ablocks * HFS_SB(sb)->fs_div; 89 buf->f_blocks = (u32)HFS_SB(sb)->fs_ablocks * HFS_SB(sb)->fs_div;
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 0ed8b7e8e87f..0a92fa2336a2 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -212,8 +212,10 @@ static void hfsplus_put_super(struct super_block *sb)
212 sb->s_fs_info = NULL; 212 sb->s_fs_info = NULL;
213} 213}
214 214
215static int hfsplus_statfs(struct super_block *sb, struct kstatfs *buf) 215static int hfsplus_statfs(struct dentry *dentry, struct kstatfs *buf)
216{ 216{
217 struct super_block *sb = dentry->d_sb;
218
217 buf->f_type = HFSPLUS_SUPER_MAGIC; 219 buf->f_type = HFSPLUS_SUPER_MAGIC;
218 buf->f_bsize = sb->s_blocksize; 220 buf->f_bsize = sb->s_blocksize;
219 buf->f_blocks = HFSPLUS_SB(sb).total_blocks << HFSPLUS_SB(sb).fs_shift; 221 buf->f_blocks = HFSPLUS_SB(sb).total_blocks << HFSPLUS_SB(sb).fs_shift;
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 04035e08f5c1..8e0d37743e7c 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -239,7 +239,7 @@ static int read_inode(struct inode *ino)
239 return(err); 239 return(err);
240} 240}
241 241
242int hostfs_statfs(struct super_block *sb, struct kstatfs *sf) 242int hostfs_statfs(struct dentry *dentry, struct kstatfs *sf)
243{ 243{
244 /* do_statfs uses struct statfs64 internally, but the linux kernel 244 /* do_statfs uses struct statfs64 internally, but the linux kernel
245 * struct statfs still has 32-bit versions for most of these fields, 245 * struct statfs still has 32-bit versions for most of these fields,
@@ -252,7 +252,7 @@ int hostfs_statfs(struct super_block *sb, struct kstatfs *sf)
252 long long f_files; 252 long long f_files;
253 long long f_ffree; 253 long long f_ffree;
254 254
255 err = do_statfs(HOSTFS_I(sb->s_root->d_inode)->host_filename, 255 err = do_statfs(HOSTFS_I(dentry->d_sb->s_root->d_inode)->host_filename,
256 &sf->f_bsize, &f_blocks, &f_bfree, &f_bavail, &f_files, 256 &sf->f_bsize, &f_blocks, &f_bfree, &f_bavail, &f_files,
257 &f_ffree, &sf->f_fsid, sizeof(sf->f_fsid), 257 &f_ffree, &sf->f_fsid, sizeof(sf->f_fsid),
258 &sf->f_namelen, sf->f_spare); 258 &sf->f_namelen, sf->f_spare);
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index 3b25cf3e2e65..f798480a363f 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -135,8 +135,9 @@ static unsigned count_bitmaps(struct super_block *s)
135 return count; 135 return count;
136} 136}
137 137
138static int hpfs_statfs(struct super_block *s, struct kstatfs *buf) 138static int hpfs_statfs(struct dentry *dentry, struct kstatfs *buf)
139{ 139{
140 struct super_block *s = dentry->d_sb;
140 struct hpfs_sb_info *sbi = hpfs_sb(s); 141 struct hpfs_sb_info *sbi = hpfs_sb(s);
141 lock_kernel(); 142 lock_kernel();
142 143
diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs_kern.c
index ec43c22bc9c0..3a9bdf58166f 100644
--- a/fs/hppfs/hppfs_kern.c
+++ b/fs/hppfs/hppfs_kern.c
@@ -616,7 +616,7 @@ static const struct file_operations hppfs_dir_fops = {
616 .fsync = hppfs_fsync, 616 .fsync = hppfs_fsync,
617}; 617};
618 618
619static int hppfs_statfs(struct super_block *sb, struct kstatfs *sf) 619static int hppfs_statfs(struct dentry *dentry, struct kstatfs *sf)
620{ 620{
621 sf->f_blocks = 0; 621 sf->f_blocks = 0;
622 sf->f_bfree = 0; 622 sf->f_bfree = 0;
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 4665c26171f7..678fc72c3646 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -467,9 +467,9 @@ static int hugetlbfs_set_page_dirty(struct page *page)
467 return 0; 467 return 0;
468} 468}
469 469
470static int hugetlbfs_statfs(struct super_block *sb, struct kstatfs *buf) 470static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf)
471{ 471{
472 struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(sb); 472 struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(dentry->d_sb);
473 473
474 buf->f_type = HUGETLBFS_MAGIC; 474 buf->f_type = HUGETLBFS_MAGIC;
475 buf->f_bsize = HPAGE_SIZE; 475 buf->f_bsize = HPAGE_SIZE;
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 17268da63a49..3f9c8ba1fa1f 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -56,7 +56,7 @@ static void isofs_put_super(struct super_block *sb)
56} 56}
57 57
58static void isofs_read_inode(struct inode *); 58static void isofs_read_inode(struct inode *);
59static int isofs_statfs (struct super_block *, struct kstatfs *); 59static int isofs_statfs (struct dentry *, struct kstatfs *);
60 60
61static kmem_cache_t *isofs_inode_cachep; 61static kmem_cache_t *isofs_inode_cachep;
62 62
@@ -901,8 +901,10 @@ out_freesbi:
901 return -EINVAL; 901 return -EINVAL;
902} 902}
903 903
904static int isofs_statfs (struct super_block *sb, struct kstatfs *buf) 904static int isofs_statfs (struct dentry *dentry, struct kstatfs *buf)
905{ 905{
906 struct super_block *sb = dentry->d_sb;
907
906 buf->f_type = ISOFS_SUPER_MAGIC; 908 buf->f_type = ISOFS_SUPER_MAGIC;
907 buf->f_bsize = sb->s_blocksize; 909 buf->f_bsize = sb->s_blocksize;
908 buf->f_blocks = (ISOFS_SB(sb)->s_nzones 910 buf->f_blocks = (ISOFS_SB(sb)->s_nzones
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c
index dd93a091ad67..9e46ea6da752 100644
--- a/fs/jffs/inode-v23.c
+++ b/fs/jffs/inode-v23.c
@@ -377,9 +377,9 @@ jffs_new_inode(const struct inode * dir, struct jffs_raw_inode *raw_inode,
377 377
378/* Get statistics of the file system. */ 378/* Get statistics of the file system. */
379static int 379static int
380jffs_statfs(struct super_block *sb, struct kstatfs *buf) 380jffs_statfs(struct dentry *dentry, struct kstatfs *buf)
381{ 381{
382 struct jffs_control *c = (struct jffs_control *) sb->s_fs_info; 382 struct jffs_control *c = (struct jffs_control *) dentry->d_sb->s_fs_info;
383 struct jffs_fmcontrol *fmc; 383 struct jffs_fmcontrol *fmc;
384 384
385 lock_kernel(); 385 lock_kernel();
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 7b6c24b14f85..2900ec3ec3af 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -192,9 +192,9 @@ int jffs2_setattr(struct dentry *dentry, struct iattr *iattr)
192 return rc; 192 return rc;
193} 193}
194 194
195int jffs2_statfs(struct super_block *sb, struct kstatfs *buf) 195int jffs2_statfs(struct dentry *dentry, struct kstatfs *buf)
196{ 196{
197 struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); 197 struct jffs2_sb_info *c = JFFS2_SB_INFO(dentry->d_sb);
198 unsigned long avail; 198 unsigned long avail;
199 199
200 buf->f_type = JFFS2_SUPER_MAGIC; 200 buf->f_type = JFFS2_SUPER_MAGIC;
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
index cd4021bcb944..6b5223565405 100644
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -175,7 +175,7 @@ void jffs2_clear_inode (struct inode *);
175void jffs2_dirty_inode(struct inode *inode); 175void jffs2_dirty_inode(struct inode *inode);
176struct inode *jffs2_new_inode (struct inode *dir_i, int mode, 176struct inode *jffs2_new_inode (struct inode *dir_i, int mode,
177 struct jffs2_raw_inode *ri); 177 struct jffs2_raw_inode *ri);
178int jffs2_statfs (struct super_block *, struct kstatfs *); 178int jffs2_statfs (struct dentry *, struct kstatfs *);
179void jffs2_write_super (struct super_block *); 179void jffs2_write_super (struct super_block *);
180int jffs2_remount_fs (struct super_block *, int *, char *); 180int jffs2_remount_fs (struct super_block *, int *, char *);
181int jffs2_do_fill_super(struct super_block *sb, void *data, int silent); 181int jffs2_do_fill_super(struct super_block *sb, void *data, int silent);
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 18a28137b90e..73d2aba084c6 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -139,9 +139,9 @@ static void jfs_destroy_inode(struct inode *inode)
139 kmem_cache_free(jfs_inode_cachep, ji); 139 kmem_cache_free(jfs_inode_cachep, ji);
140} 140}
141 141
142static int jfs_statfs(struct super_block *sb, struct kstatfs *buf) 142static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf)
143{ 143{
144 struct jfs_sb_info *sbi = JFS_SBI(sb); 144 struct jfs_sb_info *sbi = JFS_SBI(dentry->d_sb);
145 s64 maxinodes; 145 s64 maxinodes;
146 struct inomap *imap = JFS_IP(sbi->ipimap)->i_imap; 146 struct inomap *imap = JFS_IP(sbi->ipimap)->i_imap;
147 147
diff --git a/fs/libfs.c b/fs/libfs.c
index 7d70efa46da9..1b1156381787 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -20,9 +20,9 @@ int simple_getattr(struct vfsmount *mnt, struct dentry *dentry,
20 return 0; 20 return 0;
21} 21}
22 22
23int simple_statfs(struct super_block *sb, struct kstatfs *buf) 23int simple_statfs(struct dentry *dentry, struct kstatfs *buf)
24{ 24{
25 buf->f_type = sb->s_magic; 25 buf->f_type = dentry->d_sb->s_magic;
26 buf->f_bsize = PAGE_CACHE_SIZE; 26 buf->f_bsize = PAGE_CACHE_SIZE;
27 buf->f_namelen = NAME_MAX; 27 buf->f_namelen = NAME_MAX;
28 return 0; 28 return 0;
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 14f24dfbfe30..a6fb509b7341 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -19,7 +19,7 @@
19 19
20static void minix_read_inode(struct inode * inode); 20static void minix_read_inode(struct inode * inode);
21static int minix_write_inode(struct inode * inode, int wait); 21static int minix_write_inode(struct inode * inode, int wait);
22static int minix_statfs(struct super_block *sb, struct kstatfs *buf); 22static int minix_statfs(struct dentry *dentry, struct kstatfs *buf);
23static int minix_remount (struct super_block * sb, int * flags, char * data); 23static int minix_remount (struct super_block * sb, int * flags, char * data);
24 24
25static void minix_delete_inode(struct inode *inode) 25static void minix_delete_inode(struct inode *inode)
@@ -296,11 +296,11 @@ out_bad_sb:
296 return -EINVAL; 296 return -EINVAL;
297} 297}
298 298
299static int minix_statfs(struct super_block *sb, struct kstatfs *buf) 299static int minix_statfs(struct dentry *dentry, struct kstatfs *buf)
300{ 300{
301 struct minix_sb_info *sbi = minix_sb(sb); 301 struct minix_sb_info *sbi = minix_sb(dentry->d_sb);
302 buf->f_type = sb->s_magic; 302 buf->f_type = dentry->d_sb->s_magic;
303 buf->f_bsize = sb->s_blocksize; 303 buf->f_bsize = dentry->d_sb->s_blocksize;
304 buf->f_blocks = (sbi->s_nzones - sbi->s_firstdatazone) << sbi->s_log_zone_size; 304 buf->f_blocks = (sbi->s_nzones - sbi->s_firstdatazone) << sbi->s_log_zone_size;
305 buf->f_bfree = minix_count_free_blocks(sbi); 305 buf->f_bfree = minix_count_free_blocks(sbi);
306 buf->f_bavail = buf->f_bfree; 306 buf->f_bavail = buf->f_bfree;
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 8db033fab3fd..90d2ea28f333 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -39,7 +39,7 @@
39 39
40static void ncp_delete_inode(struct inode *); 40static void ncp_delete_inode(struct inode *);
41static void ncp_put_super(struct super_block *); 41static void ncp_put_super(struct super_block *);
42static int ncp_statfs(struct super_block *, struct kstatfs *); 42static int ncp_statfs(struct dentry *, struct kstatfs *);
43 43
44static kmem_cache_t * ncp_inode_cachep; 44static kmem_cache_t * ncp_inode_cachep;
45 45
@@ -724,13 +724,14 @@ static void ncp_put_super(struct super_block *sb)
724 kfree(server); 724 kfree(server);
725} 725}
726 726
727static int ncp_statfs(struct super_block *sb, struct kstatfs *buf) 727static int ncp_statfs(struct dentry *dentry, struct kstatfs *buf)
728{ 728{
729 struct dentry* d; 729 struct dentry* d;
730 struct inode* i; 730 struct inode* i;
731 struct ncp_inode_info* ni; 731 struct ncp_inode_info* ni;
732 struct ncp_server* s; 732 struct ncp_server* s;
733 struct ncp_volume_info vi; 733 struct ncp_volume_info vi;
734 struct super_block *sb = dentry->d_sb;
734 int err; 735 int err;
735 __u8 dh; 736 __u8 dh;
736 737
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index ff645a961bc8..937fbfc381bb 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -65,7 +65,7 @@ static int nfs_write_inode(struct inode *,int);
65static void nfs_delete_inode(struct inode *); 65static void nfs_delete_inode(struct inode *);
66static void nfs_clear_inode(struct inode *); 66static void nfs_clear_inode(struct inode *);
67static void nfs_umount_begin(struct super_block *); 67static void nfs_umount_begin(struct super_block *);
68static int nfs_statfs(struct super_block *, struct kstatfs *); 68static int nfs_statfs(struct dentry *, struct kstatfs *);
69static int nfs_show_options(struct seq_file *, struct vfsmount *); 69static int nfs_show_options(struct seq_file *, struct vfsmount *);
70static int nfs_show_stats(struct seq_file *, struct vfsmount *); 70static int nfs_show_stats(struct seq_file *, struct vfsmount *);
71static void nfs_zap_acl_cache(struct inode *); 71static void nfs_zap_acl_cache(struct inode *);
@@ -534,8 +534,9 @@ nfs_fill_super(struct super_block *sb, struct nfs_mount_data *data, int silent)
534} 534}
535 535
536static int 536static int
537nfs_statfs(struct super_block *sb, struct kstatfs *buf) 537nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
538{ 538{
539 struct super_block *sb = dentry->d_sb;
539 struct nfs_server *server = NFS_SB(sb); 540 struct nfs_server *server = NFS_SB(sb);
540 unsigned char blockbits; 541 unsigned char blockbits;
541 unsigned long blockres; 542 unsigned long blockres;
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index de3998f15f10..5446a0861d1d 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1310,7 +1310,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1310 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) || 1310 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) ||
1311 (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | 1311 (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |
1312 FATTR4_WORD1_SPACE_TOTAL))) { 1312 FATTR4_WORD1_SPACE_TOTAL))) {
1313 status = vfs_statfs(dentry->d_inode->i_sb, &statfs); 1313 status = vfs_statfs(dentry, &statfs);
1314 if (status) 1314 if (status)
1315 goto out_nfserr; 1315 goto out_nfserr;
1316 } 1316 }
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 1d65f13f458c..245eaa1fb59b 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1737,7 +1737,7 @@ int
1737nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat) 1737nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat)
1738{ 1738{
1739 int err = fh_verify(rqstp, fhp, 0, MAY_NOP); 1739 int err = fh_verify(rqstp, fhp, 0, MAY_NOP);
1740 if (!err && vfs_statfs(fhp->fh_dentry->d_inode->i_sb,stat)) 1740 if (!err && vfs_statfs(fhp->fh_dentry,stat))
1741 err = nfserr_io; 1741 err = nfserr_io;
1742 return err; 1742 return err;
1743} 1743}
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index d5d5e969294f..0e14acea3f8b 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -2601,10 +2601,10 @@ static unsigned long __get_nr_free_mft_records(ntfs_volume *vol,
2601 2601
2602/** 2602/**
2603 * ntfs_statfs - return information about mounted NTFS volume 2603 * ntfs_statfs - return information about mounted NTFS volume
2604 * @sb: super block of mounted volume 2604 * @dentry: dentry from mounted volume
2605 * @sfs: statfs structure in which to return the information 2605 * @sfs: statfs structure in which to return the information
2606 * 2606 *
2607 * Return information about the mounted NTFS volume @sb in the statfs structure 2607 * Return information about the mounted NTFS volume @dentry in the statfs structure
2608 * pointed to by @sfs (this is initialized with zeros before ntfs_statfs is 2608 * pointed to by @sfs (this is initialized with zeros before ntfs_statfs is
2609 * called). We interpret the values to be correct of the moment in time at 2609 * called). We interpret the values to be correct of the moment in time at
2610 * which we are called. Most values are variable otherwise and this isn't just 2610 * which we are called. Most values are variable otherwise and this isn't just
@@ -2617,8 +2617,9 @@ static unsigned long __get_nr_free_mft_records(ntfs_volume *vol,
2617 * 2617 *
2618 * Return 0 on success or -errno on error. 2618 * Return 0 on success or -errno on error.
2619 */ 2619 */
2620static int ntfs_statfs(struct super_block *sb, struct kstatfs *sfs) 2620static int ntfs_statfs(struct dentry *dentry, struct kstatfs *sfs)
2621{ 2621{
2622 struct super_block *sb = dentry->d_sb;
2622 s64 size; 2623 s64 size;
2623 ntfs_volume *vol = NTFS_SB(sb); 2624 ntfs_volume *vol = NTFS_SB(sb);
2624 ntfs_inode *mft_ni = NTFS_I(vol->mft_ino); 2625 ntfs_inode *mft_ni = NTFS_I(vol->mft_ino);
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 788b8b50dc4c..cdf73393f094 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -100,7 +100,7 @@ static int ocfs2_initialize_mem_caches(void);
100static void ocfs2_free_mem_caches(void); 100static void ocfs2_free_mem_caches(void);
101static void ocfs2_delete_osb(struct ocfs2_super *osb); 101static void ocfs2_delete_osb(struct ocfs2_super *osb);
102 102
103static int ocfs2_statfs(struct super_block *sb, struct kstatfs *buf); 103static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf);
104 104
105static int ocfs2_sync_fs(struct super_block *sb, int wait); 105static int ocfs2_sync_fs(struct super_block *sb, int wait);
106 106
@@ -857,7 +857,7 @@ static void ocfs2_put_super(struct super_block *sb)
857 mlog_exit_void(); 857 mlog_exit_void();
858} 858}
859 859
860static int ocfs2_statfs(struct super_block *sb, struct kstatfs *buf) 860static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
861{ 861{
862 struct ocfs2_super *osb; 862 struct ocfs2_super *osb;
863 u32 numbits, freebits; 863 u32 numbits, freebits;
@@ -866,9 +866,9 @@ static int ocfs2_statfs(struct super_block *sb, struct kstatfs *buf)
866 struct buffer_head *bh = NULL; 866 struct buffer_head *bh = NULL;
867 struct inode *inode = NULL; 867 struct inode *inode = NULL;
868 868
869 mlog_entry("(%p, %p)\n", sb, buf); 869 mlog_entry("(%p, %p)\n", dentry->d_sb, buf);
870 870
871 osb = OCFS2_SB(sb); 871 osb = OCFS2_SB(dentry->d_sb);
872 872
873 inode = ocfs2_get_system_file_inode(osb, 873 inode = ocfs2_get_system_file_inode(osb,
874 GLOBAL_BITMAP_SYSTEM_INODE, 874 GLOBAL_BITMAP_SYSTEM_INODE,
@@ -891,7 +891,7 @@ static int ocfs2_statfs(struct super_block *sb, struct kstatfs *buf)
891 freebits = numbits - le32_to_cpu(bm_lock->id1.bitmap1.i_used); 891 freebits = numbits - le32_to_cpu(bm_lock->id1.bitmap1.i_used);
892 892
893 buf->f_type = OCFS2_SUPER_MAGIC; 893 buf->f_type = OCFS2_SUPER_MAGIC;
894 buf->f_bsize = sb->s_blocksize; 894 buf->f_bsize = dentry->d_sb->s_blocksize;
895 buf->f_namelen = OCFS2_MAX_FILENAME_LEN; 895 buf->f_namelen = OCFS2_MAX_FILENAME_LEN;
896 buf->f_blocks = ((sector_t) numbits) * 896 buf->f_blocks = ((sector_t) numbits) *
897 (osb->s_clustersize >> osb->sb->s_blocksize_bits); 897 (osb->s_clustersize >> osb->sb->s_blocksize_bits);
diff --git a/fs/open.c b/fs/open.c
index 4f178acd4c09..a37ff861108f 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -31,18 +31,18 @@
31 31
32#include <asm/unistd.h> 32#include <asm/unistd.h>
33 33
34int vfs_statfs(struct super_block *sb, struct kstatfs *buf) 34int vfs_statfs(struct dentry *dentry, struct kstatfs *buf)
35{ 35{
36 int retval = -ENODEV; 36 int retval = -ENODEV;
37 37
38 if (sb) { 38 if (dentry) {
39 retval = -ENOSYS; 39 retval = -ENOSYS;
40 if (sb->s_op->statfs) { 40 if (dentry->d_sb->s_op->statfs) {
41 memset(buf, 0, sizeof(*buf)); 41 memset(buf, 0, sizeof(*buf));
42 retval = security_sb_statfs(sb); 42 retval = security_sb_statfs(dentry);
43 if (retval) 43 if (retval)
44 return retval; 44 return retval;
45 retval = sb->s_op->statfs(sb, buf); 45 retval = dentry->d_sb->s_op->statfs(dentry, buf);
46 if (retval == 0 && buf->f_frsize == 0) 46 if (retval == 0 && buf->f_frsize == 0)
47 buf->f_frsize = buf->f_bsize; 47 buf->f_frsize = buf->f_bsize;
48 } 48 }
@@ -52,12 +52,12 @@ int vfs_statfs(struct super_block *sb, struct kstatfs *buf)
52 52
53EXPORT_SYMBOL(vfs_statfs); 53EXPORT_SYMBOL(vfs_statfs);
54 54
55static int vfs_statfs_native(struct super_block *sb, struct statfs *buf) 55static int vfs_statfs_native(struct dentry *dentry, struct statfs *buf)
56{ 56{
57 struct kstatfs st; 57 struct kstatfs st;
58 int retval; 58 int retval;
59 59
60 retval = vfs_statfs(sb, &st); 60 retval = vfs_statfs(dentry, &st);
61 if (retval) 61 if (retval)
62 return retval; 62 return retval;
63 63
@@ -95,12 +95,12 @@ static int vfs_statfs_native(struct super_block *sb, struct statfs *buf)
95 return 0; 95 return 0;
96} 96}
97 97
98static int vfs_statfs64(struct super_block *sb, struct statfs64 *buf) 98static int vfs_statfs64(struct dentry *dentry, struct statfs64 *buf)
99{ 99{
100 struct kstatfs st; 100 struct kstatfs st;
101 int retval; 101 int retval;
102 102
103 retval = vfs_statfs(sb, &st); 103 retval = vfs_statfs(dentry, &st);
104 if (retval) 104 if (retval)
105 return retval; 105 return retval;
106 106
@@ -130,7 +130,7 @@ asmlinkage long sys_statfs(const char __user * path, struct statfs __user * buf)
130 error = user_path_walk(path, &nd); 130 error = user_path_walk(path, &nd);
131 if (!error) { 131 if (!error) {
132 struct statfs tmp; 132 struct statfs tmp;
133 error = vfs_statfs_native(nd.dentry->d_inode->i_sb, &tmp); 133 error = vfs_statfs_native(nd.dentry, &tmp);
134 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 134 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
135 error = -EFAULT; 135 error = -EFAULT;
136 path_release(&nd); 136 path_release(&nd);
@@ -149,7 +149,7 @@ asmlinkage long sys_statfs64(const char __user *path, size_t sz, struct statfs64
149 error = user_path_walk(path, &nd); 149 error = user_path_walk(path, &nd);
150 if (!error) { 150 if (!error) {
151 struct statfs64 tmp; 151 struct statfs64 tmp;
152 error = vfs_statfs64(nd.dentry->d_inode->i_sb, &tmp); 152 error = vfs_statfs64(nd.dentry, &tmp);
153 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 153 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
154 error = -EFAULT; 154 error = -EFAULT;
155 path_release(&nd); 155 path_release(&nd);
@@ -168,7 +168,7 @@ asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user * buf)
168 file = fget(fd); 168 file = fget(fd);
169 if (!file) 169 if (!file)
170 goto out; 170 goto out;
171 error = vfs_statfs_native(file->f_dentry->d_inode->i_sb, &tmp); 171 error = vfs_statfs_native(file->f_dentry, &tmp);
172 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 172 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
173 error = -EFAULT; 173 error = -EFAULT;
174 fput(file); 174 fput(file);
@@ -189,7 +189,7 @@ asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, struct statfs64 __user
189 file = fget(fd); 189 file = fget(fd);
190 if (!file) 190 if (!file)
191 goto out; 191 goto out;
192 error = vfs_statfs64(file->f_dentry->d_inode->i_sb, &tmp); 192 error = vfs_statfs64(file->f_dentry, &tmp);
193 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 193 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
194 error = -EFAULT; 194 error = -EFAULT;
195 fput(file); 195 fput(file);
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index e6cca5cd4b44..2f24c46f72a1 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -128,7 +128,7 @@ static struct inode *qnx4_alloc_inode(struct super_block *sb);
128static void qnx4_destroy_inode(struct inode *inode); 128static void qnx4_destroy_inode(struct inode *inode);
129static void qnx4_read_inode(struct inode *); 129static void qnx4_read_inode(struct inode *);
130static int qnx4_remount(struct super_block *sb, int *flags, char *data); 130static int qnx4_remount(struct super_block *sb, int *flags, char *data);
131static int qnx4_statfs(struct super_block *, struct kstatfs *); 131static int qnx4_statfs(struct dentry *, struct kstatfs *);
132 132
133static struct super_operations qnx4_sops = 133static struct super_operations qnx4_sops =
134{ 134{
@@ -282,8 +282,10 @@ unsigned long qnx4_block_map( struct inode *inode, long iblock )
282 return block; 282 return block;
283} 283}
284 284
285static int qnx4_statfs(struct super_block *sb, struct kstatfs *buf) 285static int qnx4_statfs(struct dentry *dentry, struct kstatfs *buf)
286{ 286{
287 struct super_block *sb = dentry->d_sb;
288
287 lock_kernel(); 289 lock_kernel();
288 290
289 buf->f_type = sb->s_magic; 291 buf->f_type = sb->s_magic;
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index f3ff41d33989..00f1321e9209 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -60,7 +60,7 @@ static int is_any_reiserfs_magic_string(struct reiserfs_super_block *rs)
60} 60}
61 61
62static int reiserfs_remount(struct super_block *s, int *flags, char *data); 62static int reiserfs_remount(struct super_block *s, int *flags, char *data);
63static int reiserfs_statfs(struct super_block *s, struct kstatfs *buf); 63static int reiserfs_statfs(struct dentry *dentry, struct kstatfs *buf);
64 64
65static int reiserfs_sync_fs(struct super_block *s, int wait) 65static int reiserfs_sync_fs(struct super_block *s, int wait)
66{ 66{
@@ -1938,15 +1938,15 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1938 return errval; 1938 return errval;
1939} 1939}
1940 1940
1941static int reiserfs_statfs(struct super_block *s, struct kstatfs *buf) 1941static int reiserfs_statfs(struct dentry *dentry, struct kstatfs *buf)
1942{ 1942{
1943 struct reiserfs_super_block *rs = SB_DISK_SUPER_BLOCK(s); 1943 struct reiserfs_super_block *rs = SB_DISK_SUPER_BLOCK(dentry->d_sb);
1944 1944
1945 buf->f_namelen = (REISERFS_MAX_NAME(s->s_blocksize)); 1945 buf->f_namelen = (REISERFS_MAX_NAME(s->s_blocksize));
1946 buf->f_bfree = sb_free_blocks(rs); 1946 buf->f_bfree = sb_free_blocks(rs);
1947 buf->f_bavail = buf->f_bfree; 1947 buf->f_bavail = buf->f_bfree;
1948 buf->f_blocks = sb_block_count(rs) - sb_bmap_nr(rs) - 1; 1948 buf->f_blocks = sb_block_count(rs) - sb_bmap_nr(rs) - 1;
1949 buf->f_bsize = s->s_blocksize; 1949 buf->f_bsize = dentry->d_sb->s_blocksize;
1950 /* changed to accommodate gcc folks. */ 1950 /* changed to accommodate gcc folks. */
1951 buf->f_type = REISERFS_SUPER_MAGIC; 1951 buf->f_type = REISERFS_SUPER_MAGIC;
1952 return 0; 1952 return 0;
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c
index 4d6cd6621062..283fbc6b8eea 100644
--- a/fs/romfs/inode.c
+++ b/fs/romfs/inode.c
@@ -179,12 +179,12 @@ outnobh:
179/* That's simple too. */ 179/* That's simple too. */
180 180
181static int 181static int
182romfs_statfs(struct super_block *sb, struct kstatfs *buf) 182romfs_statfs(struct dentry *dentry, struct kstatfs *buf)
183{ 183{
184 buf->f_type = ROMFS_MAGIC; 184 buf->f_type = ROMFS_MAGIC;
185 buf->f_bsize = ROMBSIZE; 185 buf->f_bsize = ROMBSIZE;
186 buf->f_bfree = buf->f_bavail = buf->f_ffree; 186 buf->f_bfree = buf->f_bavail = buf->f_ffree;
187 buf->f_blocks = (romfs_maxsize(sb)+ROMBSIZE-1)>>ROMBSBITS; 187 buf->f_blocks = (romfs_maxsize(dentry->d_sb)+ROMBSIZE-1)>>ROMBSBITS;
188 buf->f_namelen = ROMFS_MAXFN; 188 buf->f_namelen = ROMFS_MAXFN;
189 return 0; 189 return 0;
190} 190}
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c
index 4a37c2bbfa3f..506ff87c1d4b 100644
--- a/fs/smbfs/inode.c
+++ b/fs/smbfs/inode.c
@@ -48,7 +48,7 @@
48 48
49static void smb_delete_inode(struct inode *); 49static void smb_delete_inode(struct inode *);
50static void smb_put_super(struct super_block *); 50static void smb_put_super(struct super_block *);
51static int smb_statfs(struct super_block *, struct kstatfs *); 51static int smb_statfs(struct dentry *, struct kstatfs *);
52static int smb_show_options(struct seq_file *, struct vfsmount *); 52static int smb_show_options(struct seq_file *, struct vfsmount *);
53 53
54static kmem_cache_t *smb_inode_cachep; 54static kmem_cache_t *smb_inode_cachep;
@@ -641,13 +641,13 @@ out_no_server:
641} 641}
642 642
643static int 643static int
644smb_statfs(struct super_block *sb, struct kstatfs *buf) 644smb_statfs(struct dentry *dentry, struct kstatfs *buf)
645{ 645{
646 int result; 646 int result;
647 647
648 lock_kernel(); 648 lock_kernel();
649 649
650 result = smb_proc_dskattr(sb, buf); 650 result = smb_proc_dskattr(dentry, buf);
651 651
652 unlock_kernel(); 652 unlock_kernel();
653 653
diff --git a/fs/smbfs/proc.c b/fs/smbfs/proc.c
index b1b878b81730..c3495059889d 100644
--- a/fs/smbfs/proc.c
+++ b/fs/smbfs/proc.c
@@ -3226,9 +3226,9 @@ smb_proc_settime(struct dentry *dentry, struct smb_fattr *fattr)
3226} 3226}
3227 3227
3228int 3228int
3229smb_proc_dskattr(struct super_block *sb, struct kstatfs *attr) 3229smb_proc_dskattr(struct dentry *dentry, struct kstatfs *attr)
3230{ 3230{
3231 struct smb_sb_info *server = SMB_SB(sb); 3231 struct smb_sb_info *server = SMB_SB(dentry->d_sb);
3232 int result; 3232 int result;
3233 char *p; 3233 char *p;
3234 long unit; 3234 long unit;
diff --git a/fs/smbfs/proto.h b/fs/smbfs/proto.h
index 47664597e6b1..972ed7dad388 100644
--- a/fs/smbfs/proto.h
+++ b/fs/smbfs/proto.h
@@ -29,7 +29,7 @@ extern int smb_proc_getattr(struct dentry *dir, struct smb_fattr *fattr);
29extern int smb_proc_setattr(struct dentry *dir, struct smb_fattr *fattr); 29extern int smb_proc_setattr(struct dentry *dir, struct smb_fattr *fattr);
30extern int smb_proc_setattr_unix(struct dentry *d, struct iattr *attr, unsigned int major, unsigned int minor); 30extern int smb_proc_setattr_unix(struct dentry *d, struct iattr *attr, unsigned int major, unsigned int minor);
31extern int smb_proc_settime(struct dentry *dentry, struct smb_fattr *fattr); 31extern int smb_proc_settime(struct dentry *dentry, struct smb_fattr *fattr);
32extern int smb_proc_dskattr(struct super_block *sb, struct kstatfs *attr); 32extern int smb_proc_dskattr(struct dentry *dentry, struct kstatfs *attr);
33extern int smb_proc_read_link(struct smb_sb_info *server, struct dentry *d, char *buffer, int len); 33extern int smb_proc_read_link(struct smb_sb_info *server, struct dentry *d, char *buffer, int len);
34extern int smb_proc_symlink(struct smb_sb_info *server, struct dentry *d, const char *oldpath); 34extern int smb_proc_symlink(struct smb_sb_info *server, struct dentry *d, const char *oldpath);
35extern int smb_proc_link(struct smb_sb_info *server, struct dentry *dentry, struct dentry *new_dentry); 35extern int smb_proc_link(struct smb_sb_info *server, struct dentry *dentry, struct dentry *new_dentry);
diff --git a/fs/super.c b/fs/super.c
index 324c2d232f54..057b5325b7ef 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -486,7 +486,7 @@ asmlinkage long sys_ustat(unsigned dev, struct ustat __user * ubuf)
486 s = user_get_super(new_decode_dev(dev)); 486 s = user_get_super(new_decode_dev(dev));
487 if (s == NULL) 487 if (s == NULL)
488 goto out; 488 goto out;
489 err = vfs_statfs(s, &sbuf); 489 err = vfs_statfs(s->s_root, &sbuf);
490 drop_super(s); 490 drop_super(s);
491 if (err) 491 if (err)
492 goto out; 492 goto out;
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c
index 3ff89cc5833a..58b2d22142ba 100644
--- a/fs/sysv/inode.c
+++ b/fs/sysv/inode.c
@@ -85,8 +85,9 @@ static void sysv_put_super(struct super_block *sb)
85 kfree(sbi); 85 kfree(sbi);
86} 86}
87 87
88static int sysv_statfs(struct super_block *sb, struct kstatfs *buf) 88static int sysv_statfs(struct dentry *dentry, struct kstatfs *buf)
89{ 89{
90 struct super_block *sb = dentry->d_sb;
90 struct sysv_sb_info *sbi = SYSV_SB(sb); 91 struct sysv_sb_info *sbi = SYSV_SB(sb);
91 92
92 buf->f_type = sb->s_magic; 93 buf->f_type = sb->s_magic;
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 2250774a831d..44fe2cb0bbb2 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -91,7 +91,7 @@ static void udf_load_partdesc(struct super_block *, struct buffer_head *);
91static void udf_open_lvid(struct super_block *); 91static void udf_open_lvid(struct super_block *);
92static void udf_close_lvid(struct super_block *); 92static void udf_close_lvid(struct super_block *);
93static unsigned int udf_count_free(struct super_block *); 93static unsigned int udf_count_free(struct super_block *);
94static int udf_statfs(struct super_block *, struct kstatfs *); 94static int udf_statfs(struct dentry *, struct kstatfs *);
95 95
96/* UDF filesystem type */ 96/* UDF filesystem type */
97static int udf_get_sb(struct file_system_type *fs_type, 97static int udf_get_sb(struct file_system_type *fs_type,
@@ -1779,8 +1779,10 @@ udf_put_super(struct super_block *sb)
1779 * Written, tested, and released. 1779 * Written, tested, and released.
1780 */ 1780 */
1781static int 1781static int
1782udf_statfs(struct super_block *sb, struct kstatfs *buf) 1782udf_statfs(struct dentry *dentry, struct kstatfs *buf)
1783{ 1783{
1784 struct super_block *sb = dentry->d_sb;
1785
1784 buf->f_type = UDF_SUPER_MAGIC; 1786 buf->f_type = UDF_SUPER_MAGIC;
1785 buf->f_bsize = sb->s_blocksize; 1787 buf->f_bsize = sb->s_blocksize;
1786 buf->f_blocks = UDF_SB_PARTLEN(sb, UDF_SB_PARTITION(sb)); 1788 buf->f_blocks = UDF_SB_PARTLEN(sb, UDF_SB_PARTITION(sb));
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 768fb8d9e67a..fe5ab2aa2899 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -1113,8 +1113,9 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
1113 return 0; 1113 return 0;
1114} 1114}
1115 1115
1116static int ufs_statfs (struct super_block *sb, struct kstatfs *buf) 1116static int ufs_statfs (struct dentry *dentry, struct kstatfs *buf)
1117{ 1117{
1118 struct super_block *sb = dentry->d_sb;
1118 struct ufs_sb_private_info * uspi; 1119 struct ufs_sb_private_info * uspi;
1119 struct ufs_super_block_first * usb1; 1120 struct ufs_super_block_first * usb1;
1120 struct ufs_super_block * usb; 1121 struct ufs_super_block * usb;
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index d03c89a36655..4fb0fc65af34 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -684,10 +684,10 @@ xfs_fs_sync_super(
684 684
685STATIC int 685STATIC int
686xfs_fs_statfs( 686xfs_fs_statfs(
687 struct super_block *sb, 687 struct dentry *dentry,
688 struct kstatfs *statp) 688 struct kstatfs *statp)
689{ 689{
690 return -bhv_vfs_statvfs(vfs_from_sb(sb), statp, NULL); 690 return -bhv_vfs_statvfs(vfs_from_sb(dentry->d_sb), statp, NULL);
691} 691}
692 692
693STATIC int 693STATIC int
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index d539262a8f89..98f6c52c152b 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -70,7 +70,7 @@ int venus_pioctl(struct super_block *sb, struct CodaFid *fid,
70 unsigned int cmd, struct PioctlData *data); 70 unsigned int cmd, struct PioctlData *data);
71int coda_downcall(int opcode, union outputArgs *out, struct super_block *sb); 71int coda_downcall(int opcode, union outputArgs *out, struct super_block *sb);
72int venus_fsync(struct super_block *sb, struct CodaFid *fid); 72int venus_fsync(struct super_block *sb, struct CodaFid *fid);
73int venus_statfs(struct super_block *sb, struct kstatfs *sfs); 73int venus_statfs(struct dentry *dentry, struct kstatfs *sfs);
74 74
75 75
76/* messages between coda filesystem in kernel and Venus */ 76/* messages between coda filesystem in kernel and Venus */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3e50dd24af87..c823a3815e24 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1096,7 +1096,7 @@ struct super_operations {
1096 int (*sync_fs)(struct super_block *sb, int wait); 1096 int (*sync_fs)(struct super_block *sb, int wait);
1097 void (*write_super_lockfs) (struct super_block *); 1097 void (*write_super_lockfs) (struct super_block *);
1098 void (*unlockfs) (struct super_block *); 1098 void (*unlockfs) (struct super_block *);
1099 int (*statfs) (struct super_block *, struct kstatfs *); 1099 int (*statfs) (struct dentry *, struct kstatfs *);
1100 int (*remount_fs) (struct super_block *, int *, char *); 1100 int (*remount_fs) (struct super_block *, int *, char *);
1101 void (*clear_inode) (struct inode *); 1101 void (*clear_inode) (struct inode *);
1102 void (*umount_begin) (struct super_block *); 1102 void (*umount_begin) (struct super_block *);
@@ -1325,7 +1325,7 @@ extern struct vfsmount *copy_tree(struct vfsmount *, struct dentry *, int);
1325extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *, 1325extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
1326 struct vfsmount *); 1326 struct vfsmount *);
1327 1327
1328extern int vfs_statfs(struct super_block *, struct kstatfs *); 1328extern int vfs_statfs(struct dentry *, struct kstatfs *);
1329 1329
1330/* /sys/fs */ 1330/* /sys/fs */
1331extern struct subsystem fs_subsys; 1331extern struct subsystem fs_subsys;
@@ -1746,7 +1746,7 @@ extern int dcache_dir_close(struct inode *, struct file *);
1746extern loff_t dcache_dir_lseek(struct file *, loff_t, int); 1746extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
1747extern int dcache_readdir(struct file *, void *, filldir_t); 1747extern int dcache_readdir(struct file *, void *, filldir_t);
1748extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); 1748extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
1749extern int simple_statfs(struct super_block *, struct kstatfs *); 1749extern int simple_statfs(struct dentry *, struct kstatfs *);
1750extern int simple_link(struct dentry *, struct inode *, struct dentry *); 1750extern int simple_link(struct dentry *, struct inode *, struct dentry *);
1751extern int simple_unlink(struct inode *, struct dentry *); 1751extern int simple_unlink(struct inode *, struct dentry *);
1752extern int simple_rmdir(struct inode *, struct dentry *); 1752extern int simple_rmdir(struct inode *, struct dentry *);
diff --git a/include/linux/mount.h b/include/linux/mount.h
index b7472ae91fa4..60718f12caa9 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -17,6 +17,11 @@
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <asm/atomic.h> 18#include <asm/atomic.h>
19 19
20struct super_block;
21struct vfsmount;
22struct dentry;
23struct namespace;
24
20#define MNT_NOSUID 0x01 25#define MNT_NOSUID 0x01
21#define MNT_NODEV 0x02 26#define MNT_NODEV 0x02
22#define MNT_NOEXEC 0x04 27#define MNT_NOEXEC 0x04
diff --git a/include/linux/security.h b/include/linux/security.h
index 47722d355532..383c320fc834 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -171,9 +171,9 @@ struct swap_info_struct;
171 * Deallocate and clear the sb->s_security field. 171 * Deallocate and clear the sb->s_security field.
172 * @sb contains the super_block structure to be modified. 172 * @sb contains the super_block structure to be modified.
173 * @sb_statfs: 173 * @sb_statfs:
174 * Check permission before obtaining filesystem statistics for the @sb 174 * Check permission before obtaining filesystem statistics for the @mnt
175 * filesystem. 175 * mountpoint.
176 * @sb contains the super_block structure for the filesystem. 176 * @dentry is a handle on the superblock for the filesystem.
177 * Return 0 if permission is granted. 177 * Return 0 if permission is granted.
178 * @sb_mount: 178 * @sb_mount:
179 * Check permission before an object specified by @dev_name is mounted on 179 * Check permission before an object specified by @dev_name is mounted on
@@ -1127,7 +1127,7 @@ struct security_operations {
1127 int (*sb_copy_data)(struct file_system_type *type, 1127 int (*sb_copy_data)(struct file_system_type *type,
1128 void *orig, void *copy); 1128 void *orig, void *copy);
1129 int (*sb_kern_mount) (struct super_block *sb, void *data); 1129 int (*sb_kern_mount) (struct super_block *sb, void *data);
1130 int (*sb_statfs) (struct super_block * sb); 1130 int (*sb_statfs) (struct dentry *dentry);
1131 int (*sb_mount) (char *dev_name, struct nameidata * nd, 1131 int (*sb_mount) (char *dev_name, struct nameidata * nd,
1132 char *type, unsigned long flags, void *data); 1132 char *type, unsigned long flags, void *data);
1133 int (*sb_check_sb) (struct vfsmount * mnt, struct nameidata * nd); 1133 int (*sb_check_sb) (struct vfsmount * mnt, struct nameidata * nd);
@@ -1450,9 +1450,9 @@ static inline int security_sb_kern_mount (struct super_block *sb, void *data)
1450 return security_ops->sb_kern_mount (sb, data); 1450 return security_ops->sb_kern_mount (sb, data);
1451} 1451}
1452 1452
1453static inline int security_sb_statfs (struct super_block *sb) 1453static inline int security_sb_statfs (struct dentry *dentry)
1454{ 1454{
1455 return security_ops->sb_statfs (sb); 1455 return security_ops->sb_statfs (dentry);
1456} 1456}
1457 1457
1458static inline int security_sb_mount (char *dev_name, struct nameidata *nd, 1458static inline int security_sb_mount (char *dev_name, struct nameidata *nd,
@@ -2162,7 +2162,7 @@ static inline int security_sb_kern_mount (struct super_block *sb, void *data)
2162 return 0; 2162 return 0;
2163} 2163}
2164 2164
2165static inline int security_sb_statfs (struct super_block *sb) 2165static inline int security_sb_statfs (struct dentry *dentry)
2166{ 2166{
2167 return 0; 2167 return 0;
2168} 2168}
diff --git a/kernel/acct.c b/kernel/acct.c
index b327f4d20104..6802020e0ceb 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -118,7 +118,7 @@ static int check_free_space(struct file *file)
118 spin_unlock(&acct_globals.lock); 118 spin_unlock(&acct_globals.lock);
119 119
120 /* May block */ 120 /* May block */
121 if (vfs_statfs(file->f_dentry->d_inode->i_sb, &sbuf)) 121 if (vfs_statfs(file->f_dentry, &sbuf))
122 return res; 122 return res;
123 suspend = sbuf.f_blocks * SUSPEND; 123 suspend = sbuf.f_blocks * SUSPEND;
124 resume = sbuf.f_blocks * RESUME; 124 resume = sbuf.f_blocks * RESUME;
diff --git a/mm/shmem.c b/mm/shmem.c
index 7617bb1c6bf7..10020d8b4073 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1654,9 +1654,9 @@ static ssize_t shmem_file_sendfile(struct file *in_file, loff_t *ppos,
1654 return desc.error; 1654 return desc.error;
1655} 1655}
1656 1656
1657static int shmem_statfs(struct super_block *sb, struct kstatfs *buf) 1657static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf)
1658{ 1658{
1659 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); 1659 struct shmem_sb_info *sbinfo = SHMEM_SB(dentry->d_sb);
1660 1660
1661 buf->f_type = TMPFS_MAGIC; 1661 buf->f_type = TMPFS_MAGIC;
1662 buf->f_bsize = PAGE_CACHE_SIZE; 1662 buf->f_bsize = PAGE_CACHE_SIZE;
diff --git a/security/dummy.c b/security/dummy.c
index 6de4a4a5eb13..c98d553984ec 100644
--- a/security/dummy.c
+++ b/security/dummy.c
@@ -191,7 +191,7 @@ static int dummy_sb_kern_mount (struct super_block *sb, void *data)
191 return 0; 191 return 0;
192} 192}
193 193
194static int dummy_sb_statfs (struct super_block *sb) 194static int dummy_sb_statfs (struct dentry *dentry)
195{ 195{
196 return 0; 196 return 0;
197} 197}
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 524915dfda64..093efba4d9b6 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1903,13 +1903,13 @@ static int selinux_sb_kern_mount(struct super_block *sb, void *data)
1903 return superblock_has_perm(current, sb, FILESYSTEM__MOUNT, &ad); 1903 return superblock_has_perm(current, sb, FILESYSTEM__MOUNT, &ad);
1904} 1904}
1905 1905
1906static int selinux_sb_statfs(struct super_block *sb) 1906static int selinux_sb_statfs(struct dentry *dentry)
1907{ 1907{
1908 struct avc_audit_data ad; 1908 struct avc_audit_data ad;
1909 1909
1910 AVC_AUDIT_DATA_INIT(&ad,FS); 1910 AVC_AUDIT_DATA_INIT(&ad,FS);
1911 ad.u.fs.dentry = sb->s_root; 1911 ad.u.fs.dentry = dentry->d_sb->s_root;
1912 return superblock_has_perm(current, sb, FILESYSTEM__GETATTR, &ad); 1912 return superblock_has_perm(current, dentry->d_sb, FILESYSTEM__GETATTR, &ad);
1913} 1913}
1914 1914
1915static int selinux_mount(char * dev_name, 1915static int selinux_mount(char * dev_name,