Message ID | e62321f3079658ce3c5a278e48c84e5d66c306b3.1695380646.git.dsterba@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Minor cleanups in relocation.c | expand |
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
On 2023/9/22 20:37, David Sterba wrote: > We don't need to use bitfields for tree_block::level and > tree_block::key_ready, there's enough padding in the structure for > proper types. > > Signed-off-by: David Sterba <dsterba@suse.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Thanks, Qu > --- > fs/btrfs/relocation.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c > index 6e8e14d1aeaa..9ff3572a8451 100644 > --- a/fs/btrfs/relocation.c > +++ b/fs/btrfs/relocation.c > @@ -111,8 +111,8 @@ struct tree_block { > }; /* Use rb_simple_node for search/insert */ > u64 owner; > struct btrfs_key key; > - unsigned int level:8; > - unsigned int key_ready:1; > + u8 level; > + bool key_ready; > }; > > #define MAX_EXTENTS 128 > @@ -2664,7 +2664,7 @@ static int get_tree_block_key(struct btrfs_fs_info *fs_info, > else > btrfs_node_key_to_cpu(eb, &block->key, 0); > free_extent_buffer(eb); > - block->key_ready = 1; > + block->key_ready = true; > return 0; > } > > @@ -3313,7 +3313,7 @@ static int add_tree_block(struct reloc_control *rc, > block->key.objectid = rc->extent_root->fs_info->nodesize; > block->key.offset = generation; > block->level = level; > - block->key_ready = 0; > + block->key_ready = false; > block->owner = owner; > > rb_node = rb_simple_insert(blocks, block->bytenr, &block->rb_node);
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 6e8e14d1aeaa..9ff3572a8451 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -111,8 +111,8 @@ struct tree_block { }; /* Use rb_simple_node for search/insert */ u64 owner; struct btrfs_key key; - unsigned int level:8; - unsigned int key_ready:1; + u8 level; + bool key_ready; }; #define MAX_EXTENTS 128 @@ -2664,7 +2664,7 @@ static int get_tree_block_key(struct btrfs_fs_info *fs_info, else btrfs_node_key_to_cpu(eb, &block->key, 0); free_extent_buffer(eb); - block->key_ready = 1; + block->key_ready = true; return 0; } @@ -3313,7 +3313,7 @@ static int add_tree_block(struct reloc_control *rc, block->key.objectid = rc->extent_root->fs_info->nodesize; block->key.offset = generation; block->level = level; - block->key_ready = 0; + block->key_ready = false; block->owner = owner; rb_node = rb_simple_insert(blocks, block->bytenr, &block->rb_node);
We don't need to use bitfields for tree_block::level and tree_block::key_ready, there's enough padding in the structure for proper types. Signed-off-by: David Sterba <dsterba@suse.com> --- fs/btrfs/relocation.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)