]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: raid56: make btrfs_raid_bio more compact
authorQu Wenruo <wqu@suse.com>
Fri, 1 Apr 2022 11:23:17 +0000 (19:23 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 16 May 2022 15:03:14 +0000 (17:03 +0200)
commit29ea7c4bcc7c7d6a9bd5fbf4a1627fb669d531ce
treef95f4729165ad9238fb90a4bcc5872af245d276e
parentc37afefbad1dd334ecab35f2a5ed94e36f49a4a4
btrfs: raid56: make btrfs_raid_bio more compact

There are a lot of members using much larger type in btrfs_raid_bio than
necessary, like nr_pages which represents the total number of a full
stripe.

Instead of int (which is at least 32bits), u16 is already enough
(max stripe length will be 256MiB, already beyond current RAID56 device
number limit).

So this patch will reduce the width of the following members:

- stripe_len to u32
- nr_pages to u16
- nr_data to u8
- real_stripes to u8
- scrubp to u8
- faila/b to s8
  As -1 is used to indicate no corruption

This will slightly reduce the size of btrfs_raid_bio from 272 bytes to
256 bytes, reducing 16 bytes usage.

But please note that, when using btrfs_raid_bio, we allocate extra space
for it to cover various pointer array, so the reduce memory is not
really a big saving overall.

As we're here modifying the comments already, update existing comments
to current code standard.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/raid56.c