aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/9p/vfs_super.c')
-rw-r--r--fs/9p/vfs_super.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index cc3fa8c3aab6..be74d020436e 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -38,6 +38,7 @@
38#include <linux/idr.h> 38#include <linux/idr.h>
39#include <linux/sched.h> 39#include <linux/sched.h>
40#include <linux/slab.h> 40#include <linux/slab.h>
41#include <linux/statfs.h>
41#include <net/9p/9p.h> 42#include <net/9p/9p.h>
42#include <net/9p/client.h> 43#include <net/9p/client.h>
43 44
@@ -214,6 +215,42 @@ v9fs_umount_begin(struct super_block *sb)
214 v9fs_session_begin_cancel(v9ses); 215 v9fs_session_begin_cancel(v9ses);
215} 216}
216 217
218static int v9fs_statfs(struct dentry *dentry, struct kstatfs *buf)
219{
220 struct v9fs_session_info *v9ses;
221 struct p9_fid *fid;
222 struct p9_rstatfs rs;
223 int res;
224
225 fid = v9fs_fid_lookup(dentry);
226 if (IS_ERR(fid)) {
227 res = PTR_ERR(fid);
228 goto done;
229 }
230
231 v9ses = v9fs_inode2v9ses(dentry->d_inode);
232 if (v9fs_proto_dotl(v9ses)) {
233 res = p9_client_statfs(fid, &rs);
234 if (res == 0) {
235 buf->f_type = rs.type;
236 buf->f_bsize = rs.bsize;
237 buf->f_blocks = rs.blocks;
238 buf->f_bfree = rs.bfree;
239 buf->f_bavail = rs.bavail;
240 buf->f_files = rs.files;
241 buf->f_ffree = rs.ffree;
242 buf->f_fsid.val[0] = rs.fsid & 0xFFFFFFFFUL;
243 buf->f_fsid.val[1] = (rs.fsid >> 32) & 0xFFFFFFFFUL;
244 buf->f_namelen = rs.namelen;
245 }
246 if (res != -ENOSYS)
247 goto done;
248 }
249 res = simple_statfs(dentry, buf);
250done:
251 return res;
252}
253
217static const struct super_operations v9fs_super_ops = { 254static const struct super_operations v9fs_super_ops = {
218#ifdef CONFIG_9P_FSCACHE 255#ifdef CONFIG_9P_FSCACHE
219 .alloc_inode = v9fs_alloc_inode, 256 .alloc_inode = v9fs_alloc_inode,
@@ -230,7 +267,7 @@ static const struct super_operations v9fs_super_ops_dotl = {
230 .alloc_inode = v9fs_alloc_inode, 267 .alloc_inode = v9fs_alloc_inode,
231 .destroy_inode = v9fs_destroy_inode, 268 .destroy_inode = v9fs_destroy_inode,
232#endif 269#endif
233 .statfs = simple_statfs, 270 .statfs = v9fs_statfs,
234 .clear_inode = v9fs_clear_inode, 271 .clear_inode = v9fs_clear_inode,
235 .show_options = generic_show_options, 272 .show_options = generic_show_options,
236 .umount_begin = v9fs_umount_begin, 273 .umount_begin = v9fs_umount_begin,