summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2019-10-23 18:48:13 +0200
committerDavid Sterba <dsterba@suse.com>2019-11-18 17:51:44 +0100
commitf93c63e54730428f474267600fa3a901881d2829 (patch)
tree5aa86a5b3ae34f84670c6b9a6328a65c1a54d8cd /fs
parentbf38be65f3703d5ef3661c0a2802bc28e76b8f19 (diff)
downloadlinux-f93c63e54730428f474267600fa3a901881d2829.tar.bz2
btrfs: move block_group_item::flags to block group
The flags are read from the item that's embedded to block group struct, but the item will be removed. Use the ::flags after read and before write. Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/block-group.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
index 4da5e0f6cb82..52e2a05c8345 100644
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -1755,7 +1755,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info)
/* Duplicate as the item is still partially used */
memcpy(&cache->item, &bgi, sizeof(bgi));
cache->used = btrfs_block_group_used(&bgi);
- cache->flags = btrfs_block_group_flags(&cache->item);
+ cache->flags = btrfs_block_group_flags(&bgi);
if (!mixed &&
((cache->flags & BTRFS_BLOCK_GROUP_METADATA) &&
(cache->flags & BTRFS_BLOCK_GROUP_DATA))) {
@@ -1885,6 +1885,7 @@ void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans)
*/
memcpy(&item, &block_group->item, sizeof(item));
btrfs_set_block_group_used(&item, block_group->used);
+ btrfs_set_block_group_flags(&item, block_group->flags);
memcpy(&key, &block_group->key, sizeof(key));
spin_unlock(&block_group->lock);
@@ -1920,8 +1921,6 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans, u64 bytes_used,
cache->used = bytes_used;
btrfs_set_block_group_chunk_objectid(&cache->item,
BTRFS_FIRST_CHUNK_TREE_OBJECTID);
- btrfs_set_block_group_flags(&cache->item, type);
-
cache->flags = type;
cache->last_byte_to_unpin = (u64)-1;
cache->cached = BTRFS_CACHE_FINISHED;
@@ -2140,6 +2139,7 @@ static int write_one_cache_group(struct btrfs_trans_handle *trans,
/* Partial copy of item, update the rest from memory */
memcpy(&bgi, &cache->item, sizeof(bgi));
btrfs_set_block_group_used(&bgi, cache->used);
+ btrfs_set_block_group_flags(&bgi, cache->flags);
write_extent_buffer(leaf, &bgi, bi, sizeof(bgi));
btrfs_mark_buffer_dirty(leaf);
fail: