aboutsummaryrefslogtreecommitdiffstats
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)
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:
733 */ 733 */
734static int fixup_tree_root_location(struct btrfs_root *root, 734static int fixup_tree_root_location(struct btrfs_root *root,
735 struct btrfs_key *location, 735 struct btrfs_key *location,
736 struct btrfs_root **sub_root) 736 struct btrfs_root **sub_root,
737 struct dentry *dentry)
737{ 738{
738 struct btrfs_path *path; 739 struct btrfs_path *path;
739 struct btrfs_root_item *ri; 740 struct btrfs_root_item *ri;
@@ -747,7 +748,9 @@ static int fixup_tree_root_location(struct btrfs_root *root,
747 BUG_ON(!path); 748 BUG_ON(!path);
748 mutex_lock(&root->fs_info->fs_mutex); 749 mutex_lock(&root->fs_info->fs_mutex);
749 750
750 *sub_root = btrfs_read_fs_root(root->fs_info, location); 751 *sub_root = btrfs_read_fs_root(root->fs_info, location,
752 dentry->d_name.name,
753 dentry->d_name.len);
751 if (IS_ERR(*sub_root)) 754 if (IS_ERR(*sub_root))
752 return PTR_ERR(*sub_root); 755 return PTR_ERR(*sub_root);
753 756
@@ -812,7 +815,8 @@ static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry,
812 return ERR_PTR(ret); 815 return ERR_PTR(ret);
813 inode = NULL; 816 inode = NULL;
814 if (location.objectid) { 817 if (location.objectid) {
815 ret = fixup_tree_root_location(root, &location, &sub_root); 818 ret = fixup_tree_root_location(root, &location, &sub_root,
819 dentry);
816 if (ret < 0) 820 if (ret < 0)
817 return ERR_PTR(ret); 821 return ERR_PTR(ret);
818 if (ret > 0) 822 if (ret > 0)
@@ -1829,6 +1833,7 @@ static int create_subvol(struct btrfs_root *root, char *name, int namelen)
1829 1833
1830 btrfs_set_root_blocknr(&root_item, bh_blocknr(subvol)); 1834 btrfs_set_root_blocknr(&root_item, bh_blocknr(subvol));
1831 btrfs_set_root_refs(&root_item, 1); 1835 btrfs_set_root_refs(&root_item, 1);
1836 btrfs_set_root_blocks_used(&root_item, 0);
1832 memset(&root_item.drop_progress, 0, sizeof(root_item.drop_progress)); 1837 memset(&root_item.drop_progress, 0, sizeof(root_item.drop_progress));
1833 root_item.drop_level = 0; 1838 root_item.drop_level = 0;
1834 brelse(subvol); 1839 brelse(subvol);
@@ -1865,7 +1870,7 @@ static int create_subvol(struct btrfs_root *root, char *name, int namelen)
1865 if (ret) 1870 if (ret)
1866 goto fail_commit; 1871 goto fail_commit;
1867 1872
1868 new_root = btrfs_read_fs_root(root->fs_info, &key); 1873 new_root = btrfs_read_fs_root(root->fs_info, &key, name, namelen);
1869 BUG_ON(!new_root); 1874 BUG_ON(!new_root);
1870 1875
1871 trans = btrfs_start_transaction(new_root, 1); 1876 trans = btrfs_start_transaction(new_root, 1);