btrfs: use on-stack bio in scrub_recheck_block

The I/O in repair_io_failue is synchronous and doesn't need a btrfs_bio,
so just use an on-stack bio.

Reviewed-by: Qu Wenruo <wqu@suse.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 2022-04-04 06:45:21 +02:00 committed by David Sterba
parent e9458bfe5f
commit f3b8a7f3fb
1 changed files with 8 additions and 10 deletions

View File

@ -1458,8 +1458,9 @@ static void scrub_recheck_block(struct btrfs_fs_info *fs_info,
return scrub_recheck_block_on_raid56(fs_info, sblock);
for (i = 0; i < sblock->sector_count; i++) {
struct bio *bio;
struct scrub_sector *sector = sblock->sectors[i];
struct bio bio;
struct bio_vec bvec;
if (sector->dev->bdev == NULL) {
sector->io_error = 1;
@ -1468,20 +1469,17 @@ static void scrub_recheck_block(struct btrfs_fs_info *fs_info,
}
WARN_ON(!sector->page);
bio = btrfs_bio_alloc(1);
bio_set_dev(bio, sector->dev->bdev);
bio_init(&bio, sector->dev->bdev, &bvec, 1, REQ_OP_READ);
bio_add_page(&bio, sector->page, fs_info->sectorsize, 0);
bio.bi_iter.bi_sector = sector->physical >> 9;
bio_add_page(bio, sector->page, fs_info->sectorsize, 0);
bio->bi_iter.bi_sector = sector->physical >> 9;
bio->bi_opf = REQ_OP_READ;
btrfsic_check_bio(bio);
if (submit_bio_wait(bio)) {
btrfsic_check_bio(&bio);
if (submit_bio_wait(&bio)) {
sector->io_error = 1;
sblock->no_io_error_seen = 0;
}
bio_put(bio);
bio_uninit(&bio);
}
if (sblock->no_io_error_seen)