aboutsummaryrefslogtreecommitdiffstats
path: root/fs/afs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/afs/super.c')
-rw-r--r--fs/afs/super.c41
1 files changed, 36 insertions, 5 deletions
diff --git a/fs/afs/super.c b/fs/afs/super.c
index 422f532b9b62..579af632c8e8 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -21,22 +21,20 @@
21#include <linux/fs.h> 21#include <linux/fs.h>
22#include <linux/pagemap.h> 22#include <linux/pagemap.h>
23#include <linux/parser.h> 23#include <linux/parser.h>
24#include <linux/statfs.h>
24#include "internal.h" 25#include "internal.h"
25 26
26#define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */ 27#define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */
27 28
28static void afs_i_init_once(void *foo, struct kmem_cache *cachep, 29static void afs_i_init_once(void *foo, struct kmem_cache *cachep,
29 unsigned long flags); 30 unsigned long flags);
30
31static int afs_get_sb(struct file_system_type *fs_type, 31static int afs_get_sb(struct file_system_type *fs_type,
32 int flags, const char *dev_name, 32 int flags, const char *dev_name,
33 void *data, struct vfsmount *mnt); 33 void *data, struct vfsmount *mnt);
34
35static struct inode *afs_alloc_inode(struct super_block *sb); 34static struct inode *afs_alloc_inode(struct super_block *sb);
36
37static void afs_put_super(struct super_block *sb); 35static void afs_put_super(struct super_block *sb);
38
39static void afs_destroy_inode(struct inode *inode); 36static void afs_destroy_inode(struct inode *inode);
37static int afs_statfs(struct dentry *dentry, struct kstatfs *buf);
40 38
41struct file_system_type afs_fs_type = { 39struct file_system_type afs_fs_type = {
42 .owner = THIS_MODULE, 40 .owner = THIS_MODULE,
@@ -47,7 +45,7 @@ struct file_system_type afs_fs_type = {
47}; 45};
48 46
49static const struct super_operations afs_super_ops = { 47static const struct super_operations afs_super_ops = {
50 .statfs = simple_statfs, 48 .statfs = afs_statfs,
51 .alloc_inode = afs_alloc_inode, 49 .alloc_inode = afs_alloc_inode,
52 .drop_inode = generic_delete_inode, 50 .drop_inode = generic_delete_inode,
53 .write_inode = afs_write_inode, 51 .write_inode = afs_write_inode,
@@ -508,3 +506,36 @@ static void afs_destroy_inode(struct inode *inode)
508 kmem_cache_free(afs_inode_cachep, vnode); 506 kmem_cache_free(afs_inode_cachep, vnode);
509 atomic_dec(&afs_count_active_inodes); 507 atomic_dec(&afs_count_active_inodes);
510} 508}
509
510/*
511 * return information about an AFS volume
512 */
513static int afs_statfs(struct dentry *dentry, struct kstatfs *buf)
514{
515 struct afs_volume_status vs;
516 struct afs_vnode *vnode = AFS_FS_I(dentry->d_inode);
517 struct key *key;
518 int ret;
519
520 key = afs_request_key(vnode->volume->cell);
521 if (IS_ERR(key))
522 return PTR_ERR(key);
523
524 ret = afs_vnode_get_volume_status(vnode, key, &vs);
525 key_put(key);
526 if (ret < 0) {
527 _leave(" = %d", ret);
528 return ret;
529 }
530
531 buf->f_type = dentry->d_sb->s_magic;
532 buf->f_bsize = AFS_BLOCK_SIZE;
533 buf->f_namelen = AFSNAMEMAX - 1;
534
535 if (vs.max_quota == 0)
536 buf->f_blocks = vs.part_max_blocks;
537 else
538 buf->f_blocks = vs.max_quota;
539 buf->f_bavail = buf->f_bfree = buf->f_blocks - vs.blocks_in_use;
540 return 0;
541}