aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r--fs/btrfs/super.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index eba239cce212..6940a907654d 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2013,6 +2013,8 @@ static int create_subvol(struct btrfs_root *root, char *name, int namelen)
2013 BUG_ON(!trans); 2013 BUG_ON(!trans);
2014 2014
2015 subvol = btrfs_alloc_free_block(trans, root); 2015 subvol = btrfs_alloc_free_block(trans, root);
2016 if (subvol == NULL)
2017 return -ENOSPC;
2016 leaf = btrfs_buffer_leaf(subvol); 2018 leaf = btrfs_buffer_leaf(subvol);
2017 btrfs_set_header_nritems(&leaf->header, 0); 2019 btrfs_set_header_nritems(&leaf->header, 0);
2018 btrfs_set_header_level(&leaf->header, 0); 2020 btrfs_set_header_level(&leaf->header, 0);
@@ -2022,8 +2024,6 @@ static int create_subvol(struct btrfs_root *root, char *name, int namelen)
2022 memcpy(leaf->header.fsid, root->fs_info->disk_super->fsid, 2024 memcpy(leaf->header.fsid, root->fs_info->disk_super->fsid,
2023 sizeof(leaf->header.fsid)); 2025 sizeof(leaf->header.fsid));
2024 mark_buffer_dirty(subvol); 2026 mark_buffer_dirty(subvol);
2025 brelse(subvol);
2026 subvol = NULL;
2027 2027
2028 inode_item = &root_item.inode; 2028 inode_item = &root_item.inode;
2029 memset(inode_item, 0, sizeof(*inode_item)); 2029 memset(inode_item, 0, sizeof(*inode_item));
@@ -2035,6 +2035,8 @@ static int create_subvol(struct btrfs_root *root, char *name, int namelen)
2035 2035
2036 btrfs_set_root_blocknr(&root_item, bh_blocknr(subvol)); 2036 btrfs_set_root_blocknr(&root_item, bh_blocknr(subvol));
2037 btrfs_set_root_refs(&root_item, 1); 2037 btrfs_set_root_refs(&root_item, 1);
2038 brelse(subvol);
2039 subvol = NULL;
2038 2040
2039 ret = btrfs_find_free_objectid(trans, root->fs_info->tree_root, 2041 ret = btrfs_find_free_objectid(trans, root->fs_info->tree_root,
2040 0, &objectid); 2042 0, &objectid);