diff options
author | Sripathi Kodi <sripathik@in.ibm.com> | 2010-03-25 08:45:30 -0400 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2010-05-21 17:44:33 -0400 |
commit | bda8e7752063cdbdd1d308bc1705400a8cec1aeb (patch) | |
tree | cfc751da04d3ffe46d7b7e935f7ceb21b1f8a8d0 /fs/9p/vfs_super.c | |
parent | 9b6533c9b331ddbba9a40c972d82222ecffbc359 (diff) |
9p: add 9P2000.L statfs operation
I made a V2 of this patch on top of my patches for VFS switches. The
change was adding v9fs_statfs pointer to v9fs_super_ops_dotl
instead of v9fs_super_ops.
statfs - get file system statistics
size[4] Tstatfs tag[2] fid[4]
size[4] Rstatfs tag[2] type[4] bsize[4] blocks[8] bfree[8] bavail[8]
files[8] ffree[8] fsid[8] namelen[4]
The statfs message is used to request file system information returned
by the statfs(2) system call, which is used by df(1) to report file
system and disk space usage.
Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p/vfs_super.c')
-rw-r--r-- | fs/9p/vfs_super.c | 39 |
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 | ||
218 | static 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); | ||
250 | done: | ||
251 | return res; | ||
252 | } | ||
253 | |||
217 | static const struct super_operations v9fs_super_ops = { | 254 | static 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, |