diff options
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index f99c764a59db..eba239cce212 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -1819,8 +1819,9 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf, | |||
1819 | } | 1819 | } |
1820 | if (inode->i_size >= PAGE_CACHE_SIZE || pos + count < inode->i_size || | 1820 | if (inode->i_size >= PAGE_CACHE_SIZE || pos + count < inode->i_size || |
1821 | pos + count - start_pos > BTRFS_MAX_INLINE_DATA_SIZE(root)) { | 1821 | pos + count - start_pos > BTRFS_MAX_INLINE_DATA_SIZE(root)) { |
1822 | ret = btrfs_alloc_extent(trans, root, num_blocks, 1, | 1822 | ret = btrfs_alloc_extent(trans, root, inode->i_ino, |
1823 | (u64)-1, &ins); | 1823 | BTRFS_EXTENT_FILE, num_blocks, 1, |
1824 | (u64)-1, &ins); | ||
1824 | BUG_ON(ret); | 1825 | BUG_ON(ret); |
1825 | ret = btrfs_insert_file_extent(trans, root, inode->i_ino, | 1826 | ret = btrfs_insert_file_extent(trans, root, inode->i_ino, |
1826 | start_pos, ins.objectid, ins.offset); | 1827 | start_pos, ins.objectid, ins.offset); |
@@ -2017,8 +2018,12 @@ static int create_subvol(struct btrfs_root *root, char *name, int namelen) | |||
2017 | btrfs_set_header_level(&leaf->header, 0); | 2018 | btrfs_set_header_level(&leaf->header, 0); |
2018 | btrfs_set_header_blocknr(&leaf->header, bh_blocknr(subvol)); | 2019 | btrfs_set_header_blocknr(&leaf->header, bh_blocknr(subvol)); |
2019 | btrfs_set_header_generation(&leaf->header, trans->transid); | 2020 | btrfs_set_header_generation(&leaf->header, trans->transid); |
2021 | btrfs_set_header_owner(&leaf->header, root->root_key.objectid); | ||
2020 | memcpy(leaf->header.fsid, root->fs_info->disk_super->fsid, | 2022 | memcpy(leaf->header.fsid, root->fs_info->disk_super->fsid, |
2021 | sizeof(leaf->header.fsid)); | 2023 | sizeof(leaf->header.fsid)); |
2024 | mark_buffer_dirty(subvol); | ||
2025 | brelse(subvol); | ||
2026 | subvol = NULL; | ||
2022 | 2027 | ||
2023 | inode_item = &root_item.inode; | 2028 | inode_item = &root_item.inode; |
2024 | memset(inode_item, 0, sizeof(*inode_item)); | 2029 | memset(inode_item, 0, sizeof(*inode_item)); |
@@ -2031,10 +2036,6 @@ static int create_subvol(struct btrfs_root *root, char *name, int namelen) | |||
2031 | btrfs_set_root_blocknr(&root_item, bh_blocknr(subvol)); | 2036 | btrfs_set_root_blocknr(&root_item, bh_blocknr(subvol)); |
2032 | btrfs_set_root_refs(&root_item, 1); | 2037 | btrfs_set_root_refs(&root_item, 1); |
2033 | 2038 | ||
2034 | mark_buffer_dirty(subvol); | ||
2035 | brelse(subvol); | ||
2036 | subvol = NULL; | ||
2037 | |||
2038 | ret = btrfs_find_free_objectid(trans, root->fs_info->tree_root, | 2039 | ret = btrfs_find_free_objectid(trans, root->fs_info->tree_root, |
2039 | 0, &objectid); | 2040 | 0, &objectid); |
2040 | BUG_ON(ret); | 2041 | BUG_ON(ret); |