diff options
author | Qu Wenruo <wqu@suse.com> | 2022-04-01 19:23:30 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-05-16 17:03:15 +0200 |
commit | 3907ce293d68c614ce64a77fad6fca04aac30d83 (patch) | |
tree | c9be268bf14b61855fe057b322a810001f510d0a /fs/btrfs | |
parent | d4e28d9b5f04d8d8d26fb5e81f0681db109e8b93 (diff) | |
download | linux-3907ce293d68c614ce64a77fad6fca04aac30d83.tar.gz linux-3907ce293d68c614ce64a77fad6fca04aac30d83.tar.bz2 linux-3907ce293d68c614ce64a77fad6fca04aac30d83.zip |
btrfs: raid56: make alloc_rbio_essential_pages() subpage compatible
The non-compatible part is only the bitmap iteration part, now the
bitmap size is extended to rbio::stripe_nsectors, not the old
rbio::stripe_npages.
Since we're here, also slightly improve the function by:
- Rename @i to @stripe
- Rename @bit to @sectornr
- Move @page and @index into the inner loop
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/raid56.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 333dcb79de74..b30ec77c1724 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -2415,14 +2415,16 @@ void raid56_add_scrub_pages(struct btrfs_raid_bio *rbio, struct page *page, */ static int alloc_rbio_essential_pages(struct btrfs_raid_bio *rbio) { - int i; - int bit; - int index; - struct page *page; + const u32 sectorsize = rbio->bioc->fs_info->sectorsize; + int stripe; + int sectornr; + + for_each_set_bit(sectornr, rbio->dbitmap, rbio->stripe_nsectors) { + for (stripe = 0; stripe < rbio->real_stripes; stripe++) { + struct page *page; + int index = (stripe * rbio->stripe_nsectors + sectornr) * + sectorsize >> PAGE_SHIFT; - for_each_set_bit(bit, rbio->dbitmap, rbio->stripe_npages) { - for (i = 0; i < rbio->real_stripes; i++) { - index = i * rbio->stripe_npages + bit; if (rbio->stripe_pages[index]) continue; |