summaryrefslogtreecommitdiff
path: root/fs/btrfs/inode.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/inode.c
parentb888db2bd7b67f190b32934e6a86181f262ac3ec (diff)
downloadlwn-58176a9604c5db1784d2c979aea472b3be40b6f0.tar.gz
lwn-58176a9604c5db1784d2c979aea472b3be40b6f0.zip
Btrfs: Add per-root block accounting and sysfs entries
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index dc181089aa74..2e3918e6049e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -733,7 +733,8 @@ out:
*/
static int fixup_tree_root_location(struct btrfs_root *root,
struct btrfs_key *location,
- struct btrfs_root **sub_root)
+ struct btrfs_root **sub_root,
+ struct dentry *dentry)
{
struct btrfs_path *path;
struct btrfs_root_item *ri;
@@ -747,7 +748,9 @@ static int fixup_tree_root_location(struct btrfs_root *root,
BUG_ON(!path);
mutex_lock(&root->fs_info->fs_mutex);
- *sub_root = btrfs_read_fs_root(root->fs_info, location);
+ *sub_root = btrfs_read_fs_root(root->fs_info, location,
+ dentry->d_name.name,
+ dentry->d_name.len);
if (IS_ERR(*sub_root))
return PTR_ERR(*sub_root);
@@ -812,7 +815,8 @@ static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry,
return ERR_PTR(ret);
inode = NULL;
if (location.objectid) {
- ret = fixup_tree_root_location(root, &location, &sub_root);
+ ret = fixup_tree_root_location(root, &location, &sub_root,
+ dentry);
if (ret < 0)
return ERR_PTR(ret);
if (ret > 0)
@@ -1829,6 +1833,7 @@ static int create_subvol(struct btrfs_root *root, char *name, int namelen)
btrfs_set_root_blocknr(&root_item, bh_blocknr(subvol));
btrfs_set_root_refs(&root_item, 1);
+ btrfs_set_root_blocks_used(&root_item, 0);
memset(&root_item.drop_progress, 0, sizeof(root_item.drop_progress));
root_item.drop_level = 0;
brelse(subvol);
@@ -1865,7 +1870,7 @@ static int create_subvol(struct btrfs_root *root, char *name, int namelen)
if (ret)
goto fail_commit;
- new_root = btrfs_read_fs_root(root->fs_info, &key);
+ new_root = btrfs_read_fs_root(root->fs_info, &key, name, namelen);
BUG_ON(!new_root);
trans = btrfs_start_transaction(new_root, 1);