Commit 726c3342 authored by David Howells's avatar David Howells Committed by Linus Torvalds
Browse files

[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: default avatarDavid Howells <dhowells@redhat.com>
Acked-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Cc: Nathan Scott <nathans@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 454e2398
...@@ -99,7 +99,7 @@ prototypes: ...@@ -99,7 +99,7 @@ prototypes:
int (*sync_fs)(struct super_block *sb, int wait); int (*sync_fs)(struct super_block *sb, int wait);
void (*write_super_lockfs) (struct super_block *); void (*write_super_lockfs) (struct super_block *);
void (*unlockfs) (struct super_block *); void (*unlockfs) (struct super_block *);
int (*statfs) (struct super_block *, struct kstatfs *); int (*statfs) (struct dentry *, struct kstatfs *);
int (*remount_fs) (struct super_block *, int *, char *); int (*remount_fs) (struct super_block *, int *, char *);
void (*clear_inode) (struct inode *); void (*clear_inode) (struct inode *);
void (*umount_begin) (struct super_block *); void (*umount_begin) (struct super_block *);
......
...@@ -211,7 +211,7 @@ struct super_operations { ...@@ -211,7 +211,7 @@ struct super_operations {
int (*sync_fs)(struct super_block *sb, int wait); int (*sync_fs)(struct super_block *sb, int wait);
void (*write_super_lockfs) (struct super_block *); void (*write_super_lockfs) (struct super_block *);
void (*unlockfs) (struct super_block *); void (*unlockfs) (struct super_block *);
int (*statfs) (struct super_block *, struct kstatfs *); int (*statfs) (struct dentry *, struct kstatfs *);
int (*remount_fs) (struct super_block *, int *, char *); int (*remount_fs) (struct super_block *, int *, char *);
void (*clear_inode) (struct inode *); void (*clear_inode) (struct inode *);
void (*umount_begin) (struct super_block *); void (*umount_begin) (struct super_block *);
......
...@@ -244,7 +244,7 @@ do_osf_statfs(struct dentry * dentry, struct osf_statfs __user *buffer, ...@@ -244,7 +244,7 @@ do_osf_statfs(struct dentry * dentry, struct osf_statfs __user *buffer,
unsigned long bufsiz) unsigned long bufsiz)
{ {
struct kstatfs linux_stat; struct kstatfs linux_stat;
int error = vfs_statfs(dentry->d_inode->i_sb, &linux_stat); int error = vfs_statfs(dentry, &linux_stat);
if (!error) if (!error)
error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz); error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz);
return error; return error;
......
...@@ -694,7 +694,7 @@ asmlinkage int irix_statfs(const char __user *path, ...@@ -694,7 +694,7 @@ asmlinkage int irix_statfs(const char __user *path,
if (error) if (error)
goto out; goto out;
error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf); error = vfs_statfs(nd.dentry, &kbuf);
if (error) if (error)
goto dput_and_out; goto dput_and_out;
...@@ -732,7 +732,7 @@ asmlinkage int irix_fstatfs(unsigned int fd, struct irix_statfs __user *buf) ...@@ -732,7 +732,7 @@ asmlinkage int irix_fstatfs(unsigned int fd, struct irix_statfs __user *buf)
goto out; goto out;
} }
error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf); error = vfs_statfs(file->f_dentry, &kbuf);
if (error) if (error)
goto out_f; goto out_f;
...@@ -1360,7 +1360,7 @@ asmlinkage int irix_statvfs(char __user *fname, struct irix_statvfs __user *buf) ...@@ -1360,7 +1360,7 @@ asmlinkage int irix_statvfs(char __user *fname, struct irix_statvfs __user *buf)
error = user_path_walk(fname, &nd); error = user_path_walk(fname, &nd);
if (error) if (error)
goto out; goto out;
error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf); error = vfs_statfs(nd.dentry, &kbuf);
if (error) if (error)
goto dput_and_out; goto dput_and_out;
...@@ -1406,7 +1406,7 @@ asmlinkage int irix_fstatvfs(int fd, struct irix_statvfs __user *buf) ...@@ -1406,7 +1406,7 @@ asmlinkage int irix_fstatvfs(int fd, struct irix_statvfs __user *buf)
error = -EBADF; error = -EBADF;
goto out; goto out;
} }
error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf); error = vfs_statfs(file->f_dentry, &kbuf);
if (error) if (error)
goto out_f; goto out_f;
...@@ -1611,7 +1611,7 @@ asmlinkage int irix_statvfs64(char __user *fname, struct irix_statvfs64 __user * ...@@ -1611,7 +1611,7 @@ asmlinkage int irix_statvfs64(char __user *fname, struct irix_statvfs64 __user *
error = user_path_walk(fname, &nd); error = user_path_walk(fname, &nd);
if (error) if (error)
goto out; goto out;
error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf); error = vfs_statfs(nd.dentry, &kbuf);
if (error) if (error)
goto dput_and_out; goto dput_and_out;
...@@ -1658,7 +1658,7 @@ asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs __user *buf) ...@@ -1658,7 +1658,7 @@ asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs __user *buf)
error = -EBADF; error = -EBADF;
goto out; goto out;
} }
error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf); error = vfs_statfs(file->f_dentry, &kbuf);
if (error) if (error)
goto out_f; goto out_f;
......
...@@ -145,7 +145,7 @@ static int hpux_ustat(dev_t dev, struct hpux_ustat __user *ubuf) ...@@ -145,7 +145,7 @@ static int hpux_ustat(dev_t dev, struct hpux_ustat __user *ubuf)
s = user_get_super(dev); s = user_get_super(dev);
if (s == NULL) if (s == NULL)
goto out; goto out;
err = vfs_statfs(s, &sbuf); err = vfs_statfs(s->s_root, &sbuf);
drop_super(s); drop_super(s);
if (err) if (err)
goto out; goto out;
...@@ -186,12 +186,12 @@ struct hpux_statfs { ...@@ -186,12 +186,12 @@ struct hpux_statfs {
int16_t f_pad; int16_t f_pad;
}; };
static int vfs_statfs_hpux(struct super_block *sb, struct hpux_statfs *buf) static int vfs_statfs_hpux(struct dentry *dentry, struct hpux_statfs *buf)
{ {
struct kstatfs st; struct kstatfs st;
int retval; int retval;
retval = vfs_statfs(sb, &st); retval = vfs_statfs(dentry, &st);
if (retval) if (retval)
return retval; return retval;
...@@ -219,7 +219,7 @@ asmlinkage long hpux_statfs(const char __user *path, ...@@ -219,7 +219,7 @@ asmlinkage long hpux_statfs(const char __user *path,
error = user_path_walk(path, &nd); error = user_path_walk(path, &nd);
if (!error) { if (!error) {
struct hpux_statfs tmp; struct hpux_statfs tmp;
error = vfs_statfs_hpux(nd.dentry->d_inode->i_sb, &tmp); error = vfs_statfs_hpux(nd.dentry, &tmp);
if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
error = -EFAULT; error = -EFAULT;
path_release(&nd); path_release(&nd);
...@@ -237,7 +237,7 @@ asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf) ...@@ -237,7 +237,7 @@ asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf)
file = fget(fd); file = fget(fd);
if (!file) if (!file)
goto out; goto out;
error = vfs_statfs_hpux(file->f_dentry->d_inode->i_sb, &tmp); error = vfs_statfs_hpux(file->f_dentry, &tmp);
if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
error = -EFAULT; error = -EFAULT;
fput(file); fput(file);
......
...@@ -356,7 +356,7 @@ static int report_statvfs(struct vfsmount *mnt, struct inode *inode, u32 buf) ...@@ -356,7 +356,7 @@ static int report_statvfs(struct vfsmount *mnt, struct inode *inode, u32 buf)
int error; int error;
struct sol_statvfs __user *ss = A(buf); struct sol_statvfs __user *ss = A(buf);
error = vfs_statfs(mnt->mnt_sb, &s); error = vfs_statfs(mnt->mnt_root, &s);
if (!error) { if (!error) {
const char *p = mnt->mnt_sb->s_type->name; const char *p = mnt->mnt_sb->s_type->name;
int i = 0; int i = 0;
...@@ -392,7 +392,7 @@ static int report_statvfs64(struct vfsmount *mnt, struct inode *inode, u32 buf) ...@@ -392,7 +392,7 @@ static int report_statvfs64(struct vfsmount *mnt, struct inode *inode, u32 buf)
int error; int error;
struct sol_statvfs64 __user *ss = A(buf); struct sol_statvfs64 __user *ss = A(buf);
error = vfs_statfs(mnt->mnt_sb, &s); error = vfs_statfs(mnt->mnt_root, &s);
if (!error) { if (!error) {
const char *p = mnt->mnt_sb->s_type->name; const char *p = mnt->mnt_sb->s_type->name;
int i = 0; int i = 0;
......
...@@ -196,17 +196,17 @@ static int adfs_remount(struct super_block *sb, int *flags, char *data) ...@@ -196,17 +196,17 @@ static int adfs_remount(struct super_block *sb, int *flags, char *data)
return parse_options(sb, data); return parse_options(sb, data);
} }
static int adfs_statfs(struct super_block *sb, struct kstatfs *buf) static int adfs_statfs(struct dentry *dentry, struct kstatfs *buf)
{ {
struct adfs_sb_info *asb = ADFS_SB(sb); struct adfs_sb_info *asb = ADFS_SB(dentry->d_sb);
buf->f_type = ADFS_SUPER_MAGIC; buf->f_type = ADFS_SUPER_MAGIC;
buf->f_namelen = asb->s_namelen; buf->f_namelen = asb->s_namelen;
buf->f_bsize = sb->s_blocksize; buf->f_bsize = dentry->d_sb->s_blocksize;
buf->f_blocks = asb->s_size; buf->f_blocks = asb->s_size;
buf->f_files = asb->s_ids_per_zone * asb->s_map_size; buf->f_files = asb->s_ids_per_zone * asb->s_map_size;
buf->f_bavail = buf->f_bavail =
buf->f_bfree = adfs_map_free(sb); buf->f_bfree = adfs_map_free(dentry->d_sb);
buf->f_ffree = (long)(buf->f_bfree * buf->f_files) / (long)buf->f_blocks; buf->f_ffree = (long)(buf->f_bfree * buf->f_files) / (long)buf->f_blocks;
return 0; return 0;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
extern struct timezone sys_tz; extern struct timezone sys_tz;
static int affs_statfs(struct super_block *sb, struct kstatfs *buf); static int affs_statfs(struct dentry *dentry, struct kstatfs *buf);
static int affs_remount (struct super_block *sb, int *flags, char *data); static int affs_remount (struct super_block *sb, int *flags, char *data);
static void static void
...@@ -508,8 +508,9 @@ affs_remount(struct super_block *sb, int *flags, char *data) ...@@ -508,8 +508,9 @@ affs_remount(struct super_block *sb, int *flags, char *data)
} }
static int static int
affs_statfs(struct super_block *sb, struct kstatfs *buf) affs_statfs(struct dentry *dentry, struct kstatfs *buf)
{ {
struct super_block *sb = dentry->d_sb;
int free; int free;
pr_debug("AFFS: statfs() partsize=%d, reserved=%d\n",AFFS_SB(sb)->s_partition_size, pr_debug("AFFS: statfs() partsize=%d, reserved=%d\n",AFFS_SB(sb)->s_partition_size,
......
...@@ -49,7 +49,7 @@ static int befs_nls2utf(struct super_block *sb, const char *in, int in_len, ...@@ -49,7 +49,7 @@ static int befs_nls2utf(struct super_block *sb, const char *in, int in_len,
char **out, int *out_len); char **out, int *out_len);
static void befs_put_super(struct super_block *); static void befs_put_super(struct super_block *);
static int befs_remount(struct super_block *, int *, char *); static int befs_remount(struct super_block *, int *, char *);
static int befs_statfs(struct super_block *, struct kstatfs *); static int befs_statfs(struct dentry *, struct kstatfs *);
static int parse_options(char *, befs_mount_options *); static int parse_options(char *, befs_mount_options *);
static const struct super_operations befs_sops = { static const struct super_operations befs_sops = {
...@@ -880,8 +880,9 @@ befs_remount(struct super_block *sb, int *flags, char *data) ...@@ -880,8 +880,9 @@ befs_remount(struct super_block *sb, int *flags, char *data)
} }
static int static int
befs_statfs(struct super_block *sb, struct kstatfs *buf) befs_statfs(struct dentry *dentry, struct kstatfs *buf)
{ {
struct super_block *sb = dentry->d_sb;
befs_debug(sb, "---> befs_statfs()"); befs_debug(sb, "---> befs_statfs()");
......
...@@ -203,8 +203,9 @@ static void bfs_put_super(struct super_block *s) ...@@ -203,8 +203,9 @@ static void bfs_put_super(struct super_block *s)
s->s_fs_info = NULL; s->s_fs_info = NULL;
} }
static int bfs_statfs(struct super_block *s, struct kstatfs *buf) static int bfs_statfs(struct dentry *dentry, struct kstatfs *buf)
{ {
struct super_block *s = dentry->d_sb;
struct bfs_sb_info *info = BFS_SB(s); struct bfs_sb_info *info = BFS_SB(s);
u64 id = huge_encode_dev(s->s_bdev->bd_dev); u64 id = huge_encode_dev(s->s_bdev->bd_dev);
buf->f_type = BFS_MAGIC; buf->f_type = BFS_MAGIC;
......
...@@ -166,8 +166,9 @@ cifs_put_super(struct super_block *sb) ...@@ -166,8 +166,9 @@ cifs_put_super(struct super_block *sb)
} }
static int static int
cifs_statfs(struct super_block *sb, struct kstatfs *buf) cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
{ {
struct super_block *sb = dentry->d_sb;
int xid; int xid;
int rc = -EOPNOTSUPP; int rc = -EOPNOTSUPP;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
/* VFS super_block ops */ /* VFS super_block ops */
static void coda_clear_inode(struct inode *); static void coda_clear_inode(struct inode *);
static void coda_put_super(struct super_block *); static void coda_put_super(struct super_block *);
static int coda_statfs(struct super_block *sb, struct kstatfs *buf); static int coda_statfs(struct dentry *dentry, struct kstatfs *buf);
static kmem_cache_t * coda_inode_cachep; static kmem_cache_t * coda_inode_cachep;
...@@ -278,13 +278,13 @@ struct inode_operations coda_file_inode_operations = { ...@@ -278,13 +278,13 @@ struct inode_operations coda_file_inode_operations = {
.setattr = coda_setattr, .setattr = coda_setattr,
}; };
static int coda_statfs(struct super_block *sb, struct kstatfs *buf) static int coda_statfs(struct dentry *dentry, struct kstatfs *buf)
{ {
int error; int error;
lock_kernel(); lock_kernel();
error = venus_statfs(sb, buf); error = venus_statfs(dentry, buf);
unlock_kernel(); unlock_kernel();
......
...@@ -611,7 +611,7 @@ int venus_pioctl(struct super_block *sb, struct CodaFid *fid, ...@@ -611,7 +611,7 @@ int venus_pioctl(struct super_block *sb, struct CodaFid *fid,
return error; return error;
} }
int venus_statfs(struct super_block *sb, struct kstatfs *sfs) int venus_statfs(struct dentry *dentry, struct kstatfs *sfs)
{ {
union inputArgs *inp; union inputArgs *inp;
union outputArgs *outp; union outputArgs *outp;
...@@ -620,7 +620,7 @@ int venus_statfs(struct super_block *sb, struct kstatfs *sfs) ...@@ -620,7 +620,7 @@ int venus_statfs(struct super_block *sb, struct kstatfs *sfs)
insize = max_t(unsigned int, INSIZE(statfs), OUTSIZE(statfs)); insize = max_t(unsigned int, INSIZE(statfs), OUTSIZE(statfs));
UPARG(CODA_STATFS); UPARG(CODA_STATFS);
error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); error = coda_upcall(coda_sbp(dentry->d_sb), insize, &outsize, inp);
if (!error) { if (!error) {
sfs->f_blocks = outp->coda_statfs.stat.f_blocks; sfs->f_blocks = outp->coda_statfs.stat.f_blocks;
......
...@@ -197,7 +197,7 @@ asmlinkage long compat_sys_statfs(const char __user *path, struct compat_statfs ...@@ -197,7 +197,7 @@ asmlinkage long compat_sys_statfs(const char __user *path, struct compat_statfs
error = user_path_walk(path, &nd); error = user_path_walk(path, &nd);
if (!error) { if (!error) {
struct kstatfs tmp; struct kstatfs tmp;
error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp); error = vfs_statfs(nd.dentry, &tmp);
if (!error) if (!error)
error = put_compat_statfs(buf, &tmp); error = put_compat_statfs(buf, &tmp);
path_release(&nd); path_release(&nd);
...@@ -215,7 +215,7 @@ asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user ...@@ -215,7 +215,7 @@ asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user
file = fget(fd); file = fget(fd);
if (!file) if (!file)
goto out; goto out;
error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp); error = vfs_statfs(file->f_dentry, &tmp);
if (!error) if (!error)
error = put_compat_statfs(buf, &tmp); error = put_compat_statfs(buf, &tmp);
fput(file); fput(file);
...@@ -265,7 +265,7 @@ asmlinkage long compat_sys_statfs64(const char __user *path, compat_size_t sz, s ...@@ -265,7 +265,7 @@ asmlinkage long compat_sys_statfs64(const char __user *path, compat_size_t sz, s
error = user_path_walk(path, &nd); error = user_path_walk(path, &nd);
if (!error) { if (!error) {
struct kstatfs tmp; struct kstatfs tmp;
error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp); error = vfs_statfs(nd.dentry, &tmp);
if (!error) if (!error)
error = put_compat_statfs64(buf, &tmp); error = put_compat_statfs64(buf, &tmp);
path_release(&nd); path_release(&nd);
...@@ -286,7 +286,7 @@ asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct c ...@@ -286,7 +286,7 @@ asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct c
file = fget(fd); file = fget(fd);
if (!file) if (!file)
goto out; goto out;
error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp); error = vfs_statfs(file->f_dentry, &tmp);
if (!error) if (!error)
error = put_compat_statfs64(buf, &tmp); error = put_compat_statfs64(buf, &tmp);
fput(file); fput(file);
......
...@@ -322,8 +322,10 @@ out: ...@@ -322,8 +322,10 @@ out:
return -EINVAL; return -EINVAL;
} }
static int cramfs_statfs(struct super_block *sb, struct kstatfs *buf) static int cramfs_statfs(struct dentry *dentry, struct kstatfs *buf)
{ {
struct super_block *sb = dentry->d_sb;
buf->f_type = CRAMFS_MAGIC; buf->f_type = CRAMFS_MAGIC;
buf->f_bsize = PAGE_CACHE_SIZE; buf->f_bsize = PAGE_CACHE_SIZE;
buf->f_blocks = CRAMFS_SB(sb)->blocks; buf->f_blocks = CRAMFS_SB(sb)->blocks;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/vfs.h> #include <linux/vfs.h>
static int efs_statfs(struct super_block *s, struct kstatfs *buf); static int efs_statfs(struct dentry *dentry, struct kstatfs *buf);
static int efs_fill_super(struct super_block *s, void *d, int silent); static int efs_fill_super(struct super_block *s, void *d, int silent);
static int efs_get_sb(struct file_system_type *fs_type, static int efs_get_sb(struct file_system_type *fs_type,
...@@ -322,8 +322,8 @@ out_no_fs: ...@@ -322,8 +322,8 @@ out_no_fs:
return -EINVAL; return -EINVAL;
} }
static int efs_statfs(struct super_block *s, struct kstatfs *buf) { static int efs_statfs(struct dentry *dentry, struct kstatfs *buf) {
struct efs_sb_info *sb = SUPER_INFO(s); struct efs_sb_info *sb = SUPER_INFO(dentry->d_sb);
buf->f_type = EFS_SUPER_MAGIC; /* efs magic number */ buf->f_type = EFS_SUPER_MAGIC; /* efs magic number */
buf->f_bsize = EFS_BLOCKSIZE; /* blocksize */ buf->f_bsize = EFS_BLOCKSIZE; /* blocksize */
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
static void ext2_sync_super(struct super_block *sb, static void ext2_sync_super(struct super_block *sb,
struct ext2_super_block *es); struct ext2_super_block *es);
static int ext2_remount (struct super_block * sb, int * flags, char * data); static int ext2_remount (struct super_block * sb, int * flags, char * data);
static int ext2_statfs (struct super_block * sb, struct kstatfs * buf); static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf);
void ext2_error (struct super_block * sb, const char * function, void ext2_error (struct super_block * sb, const char * function,
const char * fmt, ...) const char * fmt, ...)
...@@ -1038,8 +1038,9 @@ restore_opts: ...@@ -1038,8 +1038,9 @@ restore_opts:
return err; return err;
} }
static int ext2_statfs (struct super_block * sb, struct kstatfs * buf) static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf)
{ {
struct super_block *sb = dentry->d_sb;
struct ext2_sb_info *sbi = EXT2_SB(sb); struct ext2_sb_info *sbi = EXT2_SB(sb);
unsigned long overhead; unsigned long overhead;
int i; int i;
......
...@@ -58,7 +58,7 @@ static int ext3_sync_fs(struct super_block *sb, int wait); ...@@ -58,7 +58,7 @@ static int ext3_sync_fs(struct super_block *sb, int wait);
static const char *ext3_decode_error(struct super_block * sb, int errno, static const char *ext3_decode_error(struct super_block * sb, int errno,
char nbuf[16]); char nbuf[16]);
static int ext3_remount (struct super_block * sb, int * flags, char * data); static int ext3_remount (struct super_block * sb, int * flags, char * data);
static int ext3_statfs (struct super_block * sb, struct kstatfs * buf); static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf);
static void ext3_unlockfs(struct super_block *sb); static void ext3_unlockfs(struct super_block *sb);
static void ext3_write_super (struct super_block * sb); static void ext3_write_super (struct super_block * sb);
static void ext3_write_super_lockfs(struct super_block *sb); static void ext3_write_super_lockfs(struct super_block *sb);
...@@ -2318,8 +2318,9 @@ restore_opts: ...@@ -2318,8 +2318,9 @@ restore_opts:
return err; return err;
} }
static int ext3_statfs (struct super_block * sb, struct kstatfs * buf) static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf)
{ {
struct super_block *sb = dentry->d_sb;
struct ext3_sb_info *sbi = EXT3_SB(sb); struct ext3_sb_info *sbi = EXT3_SB(sb);
struct ext3_super_block *es = sbi->s_es; struct ext3_super_block *es = sbi->s_es;
unsigned long overhead; unsigned long overhead;
......
...@@ -539,18 +539,18 @@ static int fat_remount(struct super_block *sb, int *flags, char *data) ...@@ -539,18 +539,18 @@ static int fat_remount(struct super_block *sb, int *flags, char *data)
return 0; return 0;
} }
static int fat_statfs(struct super_block *sb, struct kstatfs *buf) static int fat_statfs(struct dentry *dentry, struct kstatfs *buf)
{ {
struct msdos_sb_info *sbi = MSDOS_SB(sb); struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb);
/* If the count of free cluster is still unknown, counts it here. */ /* If the count of free cluster is still unknown, counts it here. */
if (sbi->free_clusters == -1) { if (sbi->free_clusters == -1) {
int err = fat_count_free_clusters(sb); int err = fat_count_free_clusters(dentry->d_sb);
if (err) if (err)
return err; return err;
} }