]> git.hungrycats.org Git - linux/commitdiff
btrfs: reduce the width of num_stripes and sub_stripes
authorQu Wenruo <wqu@suse.com>
Wed, 21 Oct 2026 03:39:35 +0000 (14:09 +1030)
committerDavid Sterba <dsterba@suse.com>
Fri, 30 Oct 2026 20:36:18 +0000 (21:36 +0100)
The on-disk btrfs_chunk structure uses u16 for both num_stripes and
sub_stripes, so there is no need to use "int" to represent them in
btrfs_chunk_map.

Follow the on-disk format to use u16 for those members, including
verified_stripes too.

And since verified_stripes is u16, it no longer completely fill the
hole between @refs and @start.
Instead use @num_stripes and @sub_stripes to fill the hole, and leave a 6
bytes hole between @verified_stripes and @stripes.

This doesn't save any space for btrfs_chunk_map, but leaves enough space
for future expansion.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.h

index 67464025e449b2f3b4fa19b7b9fb67f73141593a..d97ca875c596671ecc6b071e96e8216b5f260e0a 100644 (file)
@@ -623,9 +623,9 @@ extern const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES];
 
 struct btrfs_chunk_map {
        struct rb_node rb_node;
-       /* For mount time dev extent verification. */
-       int verified_stripes;
        refcount_t refs;
+       u16 num_stripes;
+       u16 sub_stripes;
        u64 start;
        u64 chunk_len;
        u64 dev_extent_size;
@@ -638,8 +638,8 @@ struct btrfs_chunk_map {
         */
        u64 type;
        u64 on_disk_type;
-       int num_stripes;
-       int sub_stripes;
+       /* For mount time dev extent verification. */
+       u16 verified_stripes;
        struct btrfs_io_stripe stripes[];
 };