btrfs: raid56: handle endio in scrub_rbio

The only caller of scrub_rbio calls rbio_orig_end_io right after it,
move it into scrub_rbio to match the other work item helpers.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Christoph Hellwig 2023-01-11 07:23:34 +01:00 committed by David Sterba
parent 40f87ddb5d
commit 08241d3c74
1 changed files with 7 additions and 11 deletions

View File

@ -2701,7 +2701,7 @@ static int scrub_assemble_read_bios(struct btrfs_raid_bio *rbio)
return 0; return 0;
} }
static int scrub_rbio(struct btrfs_raid_bio *rbio) static void scrub_rbio(struct btrfs_raid_bio *rbio)
{ {
bool need_check = false; bool need_check = false;
int sector_nr; int sector_nr;
@ -2709,18 +2709,18 @@ static int scrub_rbio(struct btrfs_raid_bio *rbio)
ret = alloc_rbio_essential_pages(rbio); ret = alloc_rbio_essential_pages(rbio);
if (ret) if (ret)
return ret; goto out;
bitmap_clear(rbio->error_bitmap, 0, rbio->nr_sectors); bitmap_clear(rbio->error_bitmap, 0, rbio->nr_sectors);
ret = scrub_assemble_read_bios(rbio); ret = scrub_assemble_read_bios(rbio);
if (ret < 0) if (ret < 0)
return ret; goto out;
/* We may have some failures, recover the failed sectors first. */ /* We may have some failures, recover the failed sectors first. */
ret = recover_scrub_rbio(rbio); ret = recover_scrub_rbio(rbio);
if (ret < 0) if (ret < 0)
return ret; goto out;
/* /*
* We have every sector properly prepared. Can finish the scrub * We have every sector properly prepared. Can finish the scrub
@ -2737,17 +2737,13 @@ static int scrub_rbio(struct btrfs_raid_bio *rbio)
break; break;
} }
} }
return ret; out:
rbio_orig_end_io(rbio, errno_to_blk_status(ret));
} }
static void scrub_rbio_work_locked(struct work_struct *work) static void scrub_rbio_work_locked(struct work_struct *work)
{ {
struct btrfs_raid_bio *rbio; scrub_rbio(container_of(work, struct btrfs_raid_bio, work));
int ret;
rbio = container_of(work, struct btrfs_raid_bio, work);
ret = scrub_rbio(rbio);
rbio_orig_end_io(rbio, errno_to_blk_status(ret));
} }
void raid56_parity_submit_scrub_rbio(struct btrfs_raid_bio *rbio) void raid56_parity_submit_scrub_rbio(struct btrfs_raid_bio *rbio)