diff options
author | David Sterba <dsterba@suse.com> | 2016-04-01 17:08:51 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-05-11 15:50:26 +0200 |
commit | 5b1bbc8924c0bd79e9864584361ee56f5bdc3b05 (patch) | |
tree | 49cc7a4e592450d031d4a6a1d270139fff6bc6dc | |
parent | 427643f0694a6d8d4483a12aea610e446fc8aec1 (diff) |
btrfs-progs: check: reduce size of extent_record
There are just 3 values of flag_block_full_backref, we can utilize a
bitfield and save 8 bytes (192 now).
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | cmds-check.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/cmds-check.c b/cmds-check.c index 59160f1d..c938baff 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -122,6 +122,9 @@ struct tree_backref { }; }; +/* Explicit initialization for extent_record::flag_block_full_backref */ +enum { FLAG_UNSET = 2 }; + struct extent_record { struct list_head backrefs; struct list_head dups; @@ -138,7 +141,7 @@ struct extent_record { u64 info_objectid; u32 num_duplicates; u8 info_level; - int flag_block_full_backref; + unsigned int flag_block_full_backref:2; unsigned int found_rec:1; unsigned int content_checked:1; unsigned int owner_ref_checked:1; @@ -4531,7 +4534,7 @@ static int add_extent_rec_nolookup(struct cache_tree *extent_cache, rec->owner_ref_checked = tmpl->owner_ref_checked; rec->num_duplicates = 0; rec->metadata = tmpl->metadata; - rec->flag_block_full_backref = -1; + rec->flag_block_full_backref = FLAG_UNSET; rec->bad_full_backref = 0; rec->crossing_stripes = 0; rec->wrong_chunk_type = 0; @@ -5931,13 +5934,13 @@ static int calc_extent_flag(struct btrfs_root *root, goto full_backref; normal: *flags = 0; - if (rec->flag_block_full_backref != -1 && + if (rec->flag_block_full_backref != FLAG_UNSET && rec->flag_block_full_backref != 0) rec->bad_full_backref = 1; return 0; full_backref: *flags |= BTRFS_BLOCK_FLAG_FULL_BACKREF; - if (rec->flag_block_full_backref != -1 && + if (rec->flag_block_full_backref != FLAG_UNSET && rec->flag_block_full_backref != 1) rec->bad_full_backref = 1; return 0; |