aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@redhat.com>2007-08-29 15:47:34 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-08-29 15:47:34 -0400
commit58176a9604c5db1784d2c979aea472b3be40b6f0 (patch)
treea0d887c81b2f174de619dfefca19674a43756971 /fs/btrfs/super.c
parentb888db2bd7b67f190b32934e6a86181f262ac3ec (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.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 7da95538745..a68101ae1a3 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -45,12 +45,14 @@ static struct super_operations btrfs_super_ops;
static void btrfs_put_super (struct super_block * sb)
{
struct btrfs_root *root = btrfs_sb(sb);
+ struct btrfs_fs_info *fs = root->fs_info;
int ret;
ret = close_ctree(root);
if (ret) {
printk("close ctree returns %d\n", ret);
}
+ btrfs_sysfs_del_super(fs);
sb->s_fs_info = NULL;
}
@@ -101,6 +103,12 @@ static int btrfs_fill_super(struct super_block * sb, void * data, int silent)
err = -ENOMEM;
goto fail_close;
}
+
+ /* this does the super kobj at the same time */
+ err = btrfs_sysfs_add_super(tree_root->fs_info);
+ if (err)
+ goto fail_close;
+
sb->s_root = root_dentry;
btrfs_transaction_queue_work(tree_root, HZ * 30);
return 0;
@@ -182,6 +190,11 @@ static struct super_operations btrfs_super_ops = {
static int __init init_btrfs_fs(void)
{
int err;
+
+ err = btrfs_init_sysfs();
+ if (err)
+ return err;
+
btrfs_init_transaction_sys();
err = btrfs_init_cachep();
if (err)
@@ -196,6 +209,7 @@ static void __exit exit_btrfs_fs(void)
btrfs_destroy_cachep();
extent_map_exit();
unregister_filesystem(&btrfs_fs_type);
+ btrfs_exit_sysfs();
}
module_init(init_btrfs_fs)