mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 15:12:13 +02:00
btrfs: raid56: submit the read bios from scrub_assemble_read_bios
Instead of filling in a bio_list and submitting the bios in the only caller, do that in scrub_assemble_read_bios. This removes the need to pass the bio_list, and also makes it clear that the extra bio_list cleanup in the caller is entirely pointless. Rename the function to scrub_read_bios to make it clear that the bios are not only assembled. 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:
parent
02efa3a6ba
commit
52f0c19864
|
|
@ -2674,14 +2674,12 @@ static int recover_scrub_rbio(struct btrfs_raid_bio *rbio)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int scrub_assemble_read_bios(struct btrfs_raid_bio *rbio,
|
||||
struct bio_list *bio_list)
|
||||
static int scrub_assemble_read_bios(struct btrfs_raid_bio *rbio)
|
||||
{
|
||||
struct bio_list bio_list = BIO_EMPTY_LIST;
|
||||
int total_sector_nr;
|
||||
int ret = 0;
|
||||
|
||||
ASSERT(bio_list_size(bio_list) == 0);
|
||||
|
||||
/* Build a list of bios to read all the missing parts. */
|
||||
for (total_sector_nr = 0; total_sector_nr < rbio->nr_sectors;
|
||||
total_sector_nr++) {
|
||||
|
|
@ -2710,42 +2708,38 @@ static int scrub_assemble_read_bios(struct btrfs_raid_bio *rbio,
|
|||
if (sector->uptodate)
|
||||
continue;
|
||||
|
||||
ret = rbio_add_io_sector(rbio, bio_list, sector, stripe,
|
||||
ret = rbio_add_io_sector(rbio, &bio_list, sector, stripe,
|
||||
sectornr, REQ_OP_READ);
|
||||
if (ret)
|
||||
goto error;
|
||||
if (ret) {
|
||||
bio_list_put(&bio_list);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
submit_read_wait_bio_list(rbio, &bio_list);
|
||||
return 0;
|
||||
error:
|
||||
bio_list_put(bio_list);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int scrub_rbio(struct btrfs_raid_bio *rbio)
|
||||
{
|
||||
bool need_check = false;
|
||||
struct bio_list bio_list;
|
||||
int sector_nr;
|
||||
int ret;
|
||||
|
||||
bio_list_init(&bio_list);
|
||||
|
||||
ret = alloc_rbio_essential_pages(rbio);
|
||||
if (ret)
|
||||
goto cleanup;
|
||||
return ret;
|
||||
|
||||
bitmap_clear(rbio->error_bitmap, 0, rbio->nr_sectors);
|
||||
|
||||
ret = scrub_assemble_read_bios(rbio, &bio_list);
|
||||
ret = scrub_assemble_read_bios(rbio);
|
||||
if (ret < 0)
|
||||
goto cleanup;
|
||||
|
||||
submit_read_wait_bio_list(rbio, &bio_list);
|
||||
return ret;
|
||||
|
||||
/* We may have some failures, recover the failed sectors first. */
|
||||
ret = recover_scrub_rbio(rbio);
|
||||
if (ret < 0)
|
||||
goto cleanup;
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* We have every sector properly prepared. Can finish the scrub
|
||||
|
|
@ -2763,10 +2757,6 @@ static int scrub_rbio(struct btrfs_raid_bio *rbio)
|
|||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
cleanup:
|
||||
bio_list_put(&bio_list);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void scrub_rbio_work_locked(struct work_struct *work)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user