Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

btrfs: remove unused raid56 functions which were dedicated for scrub

Since the scrub rework, the following RAID56 functions are no longer
called:

- raid56_add_scrub_pages()
- raid56_alloc_missing_rbio()
- raid56_submit_missing_rbio()

Those functions are all utilized by scrub to handle missing device cases
for RAID56.

However the new scrub code handle them in a completely different way:

- If it's data stripe, go recovery path through btrfs_submit_bio()
- If it's P/Q stripe, it would be handled through
raid56_parity_submit_scrub_rbio()
And that function would handle dev-replace and repair properly.

Thus we can safely remove those functions.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Qu Wenruo and committed by
David Sterba
aca43fe8 13a62fd9

-54
-47
fs/btrfs/raid56.c
··· 2376 2376 return rbio; 2377 2377 } 2378 2378 2379 - /* Used for both parity scrub and missing. */ 2380 - void raid56_add_scrub_pages(struct btrfs_raid_bio *rbio, struct page *page, 2381 - unsigned int pgoff, u64 logical) 2382 - { 2383 - const u32 sectorsize = rbio->bioc->fs_info->sectorsize; 2384 - int stripe_offset; 2385 - int index; 2386 - 2387 - ASSERT(logical >= rbio->bioc->full_stripe_logical); 2388 - ASSERT(logical + sectorsize <= rbio->bioc->full_stripe_logical + 2389 - BTRFS_STRIPE_LEN * rbio->nr_data); 2390 - stripe_offset = (int)(logical - rbio->bioc->full_stripe_logical); 2391 - index = stripe_offset / sectorsize; 2392 - rbio->bio_sectors[index].page = page; 2393 - rbio->bio_sectors[index].pgoff = pgoff; 2394 - } 2395 - 2396 2379 /* 2397 2380 * We just scrub the parity that we have correct data on the same horizontal, 2398 2381 * so we needn't allocate all pages for all the stripes. ··· 2746 2763 { 2747 2764 if (!lock_stripe_add(rbio)) 2748 2765 start_async_work(rbio, scrub_rbio_work_locked); 2749 - } 2750 - 2751 - /* The following code is used for dev replace of a missing RAID 5/6 device. */ 2752 - 2753 - struct btrfs_raid_bio * 2754 - raid56_alloc_missing_rbio(struct bio *bio, struct btrfs_io_context *bioc) 2755 - { 2756 - struct btrfs_fs_info *fs_info = bioc->fs_info; 2757 - struct btrfs_raid_bio *rbio; 2758 - 2759 - rbio = alloc_rbio(fs_info, bioc); 2760 - if (IS_ERR(rbio)) 2761 - return NULL; 2762 - 2763 - rbio->operation = BTRFS_RBIO_REBUILD_MISSING; 2764 - bio_list_add(&rbio->bio_list, bio); 2765 - /* 2766 - * This is a special bio which is used to hold the completion handler 2767 - * and make the scrub rbio is similar to the other types 2768 - */ 2769 - ASSERT(!bio->bi_iter.bi_size); 2770 - 2771 - set_rbio_range_error(rbio, bio); 2772 - 2773 - return rbio; 2774 - } 2775 - 2776 - void raid56_submit_missing_rbio(struct btrfs_raid_bio *rbio) 2777 - { 2778 - start_async_work(rbio, recover_rbio_work); 2779 2766 }
-7
fs/btrfs/raid56.h
··· 187 187 int mirror_num); 188 188 void raid56_parity_write(struct bio *bio, struct btrfs_io_context *bioc); 189 189 190 - void raid56_add_scrub_pages(struct btrfs_raid_bio *rbio, struct page *page, 191 - unsigned int pgoff, u64 logical); 192 - 193 190 struct btrfs_raid_bio *raid56_parity_alloc_scrub_rbio(struct bio *bio, 194 191 struct btrfs_io_context *bioc, 195 192 struct btrfs_device *scrub_dev, 196 193 unsigned long *dbitmap, int stripe_nsectors); 197 194 void raid56_parity_submit_scrub_rbio(struct btrfs_raid_bio *rbio); 198 - 199 - struct btrfs_raid_bio * 200 - raid56_alloc_missing_rbio(struct bio *bio, struct btrfs_io_context *bioc); 201 - void raid56_submit_missing_rbio(struct btrfs_raid_bio *rbio); 202 195 203 196 int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info); 204 197 void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info);