diff options
author | Josef Bacik <jbacik@redhat.com> | 2007-08-29 15:47:34 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-08-29 15:47:34 -0400 |
commit | 58176a9604c5db1784d2c979aea472b3be40b6f0 (patch) | |
tree | a0d887c81b2f174de619dfefca19674a43756971 /fs/btrfs/super.c | |
parent | b888db2bd7b67f190b32934e6a86181f262ac3ec (diff) |
Btrfs: Add per-root block accounting and sysfs entries
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 7da95538745f..a68101ae1a3b 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -45,12 +45,14 @@ static struct super_operations btrfs_super_ops; | |||
45 | static void btrfs_put_super (struct super_block * sb) | 45 | static void btrfs_put_super (struct super_block * sb) |
46 | { | 46 | { |
47 | struct btrfs_root *root = btrfs_sb(sb); | 47 | struct btrfs_root *root = btrfs_sb(sb); |
48 | struct btrfs_fs_info *fs = root->fs_info; | ||
48 | int ret; | 49 | int ret; |
49 | 50 | ||
50 | ret = close_ctree(root); | 51 | ret = close_ctree(root); |
51 | if (ret) { | 52 | if (ret) { |
52 | printk("close ctree returns %d\n", ret); | 53 | printk("close ctree returns %d\n", ret); |
53 | } | 54 | } |
55 | btrfs_sysfs_del_super(fs); | ||
54 | sb->s_fs_info = NULL; | 56 | sb->s_fs_info = NULL; |
55 | } | 57 | } |
56 | 58 | ||
@@ -101,6 +103,12 @@ static int btrfs_fill_super(struct super_block * sb, void * data, int silent) | |||
101 | err = -ENOMEM; | 103 | err = -ENOMEM; |
102 | goto fail_close; | 104 | goto fail_close; |
103 | } | 105 | } |
106 | |||
107 | /* this does the super kobj at the same time */ | ||
108 | err = btrfs_sysfs_add_super(tree_root->fs_info); | ||
109 | if (err) | ||
110 | goto fail_close; | ||
111 | |||
104 | sb->s_root = root_dentry; | 112 | sb->s_root = root_dentry; |
105 | btrfs_transaction_queue_work(tree_root, HZ * 30); | 113 | btrfs_transaction_queue_work(tree_root, HZ * 30); |
106 | return 0; | 114 | return 0; |
@@ -182,6 +190,11 @@ static struct super_operations btrfs_super_ops = { | |||
182 | static int __init init_btrfs_fs(void) | 190 | static int __init init_btrfs_fs(void) |
183 | { | 191 | { |
184 | int err; | 192 | int err; |
193 | |||
194 | err = btrfs_init_sysfs(); | ||
195 | if (err) | ||
196 | return err; | ||
197 | |||
185 | btrfs_init_transaction_sys(); | 198 | btrfs_init_transaction_sys(); |
186 | err = btrfs_init_cachep(); | 199 | err = btrfs_init_cachep(); |
187 | if (err) | 200 | if (err) |
@@ -196,6 +209,7 @@ static void __exit exit_btrfs_fs(void) | |||
196 | btrfs_destroy_cachep(); | 209 | btrfs_destroy_cachep(); |
197 | extent_map_exit(); | 210 | extent_map_exit(); |
198 | unregister_filesystem(&btrfs_fs_type); | 211 | unregister_filesystem(&btrfs_fs_type); |
212 | btrfs_exit_sysfs(); | ||
199 | } | 213 | } |
200 | 214 | ||
201 | module_init(init_btrfs_fs) | 215 | module_init(init_btrfs_fs) |