Skip to content

Commit aca43fe

Browse files
adam900710kdave
authored andcommitted
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>
1 parent 13a62fd commit aca43fe

2 files changed

Lines changed: 0 additions & 54 deletions

File tree

fs/btrfs/raid56.c

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,23 +2376,6 @@ struct btrfs_raid_bio *raid56_parity_alloc_scrub_rbio(struct bio *bio,
23762376
return rbio;
23772377
}
23782378

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-
23962379
/*
23972380
* We just scrub the parity that we have correct data on the same horizontal,
23982381
* so we needn't allocate all pages for all the stripes.
@@ -2764,33 +2747,3 @@ void raid56_parity_submit_scrub_rbio(struct btrfs_raid_bio *rbio)
27642747
if (!lock_stripe_add(rbio))
27652748
start_async_work(rbio, scrub_rbio_work_locked);
27662749
}
2767-
2768-
/* The following code is used for dev replace of a missing RAID 5/6 device. */
2769-
2770-
struct btrfs_raid_bio *
2771-
raid56_alloc_missing_rbio(struct bio *bio, struct btrfs_io_context *bioc)
2772-
{
2773-
struct btrfs_fs_info *fs_info = bioc->fs_info;
2774-
struct btrfs_raid_bio *rbio;
2775-
2776-
rbio = alloc_rbio(fs_info, bioc);
2777-
if (IS_ERR(rbio))
2778-
return NULL;
2779-
2780-
rbio->operation = BTRFS_RBIO_REBUILD_MISSING;
2781-
bio_list_add(&rbio->bio_list, bio);
2782-
/*
2783-
* This is a special bio which is used to hold the completion handler
2784-
* and make the scrub rbio is similar to the other types
2785-
*/
2786-
ASSERT(!bio->bi_iter.bi_size);
2787-
2788-
set_rbio_range_error(rbio, bio);
2789-
2790-
return rbio;
2791-
}
2792-
2793-
void raid56_submit_missing_rbio(struct btrfs_raid_bio *rbio)
2794-
{
2795-
start_async_work(rbio, recover_rbio_work);
2796-
}

fs/btrfs/raid56.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,19 +187,12 @@ void raid56_parity_recover(struct bio *bio, struct btrfs_io_context *bioc,
187187
int mirror_num);
188188
void raid56_parity_write(struct bio *bio, struct btrfs_io_context *bioc);
189189

190-
void raid56_add_scrub_pages(struct btrfs_raid_bio *rbio, struct page *page,
191-
unsigned int pgoff, u64 logical);
192-
193190
struct btrfs_raid_bio *raid56_parity_alloc_scrub_rbio(struct bio *bio,
194191
struct btrfs_io_context *bioc,
195192
struct btrfs_device *scrub_dev,
196193
unsigned long *dbitmap, int stripe_nsectors);
197194
void raid56_parity_submit_scrub_rbio(struct btrfs_raid_bio *rbio);
198195

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-
203196
int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info);
204197
void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info);
205198

0 commit comments

Comments
 (0)