The I/O in repair_io_failue is synchronous and doesn't need a btrfs_bio, so just use an on-stack bio. Signed-off-by: Christoph Hellwig <hch@xxxxxx> Reviewed-by: Qu Wenruo <wqu@xxxxxxxx> --- fs/btrfs/scrub.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index a726962a51984..74c0557e6a2f9 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -1462,8 +1462,9 @@ static void scrub_recheck_block(struct btrfs_fs_info *fs_info, return scrub_recheck_block_on_raid56(fs_info, sblock); for (page_num = 0; page_num < sblock->page_count; page_num++) { - struct bio *bio; struct scrub_page *spage = sblock->pagev[page_num]; + struct bio bio; + struct bio_vec bvec; if (spage->dev->bdev == NULL) { spage->io_error = 1; @@ -1472,20 +1473,17 @@ static void scrub_recheck_block(struct btrfs_fs_info *fs_info, } WARN_ON(!spage->page); - bio = btrfs_bio_alloc(1); - bio_set_dev(bio, spage->dev->bdev); - - bio_add_page(bio, spage->page, fs_info->sectorsize, 0); - bio->bi_iter.bi_sector = spage->physical >> 9; - bio->bi_opf = REQ_OP_READ; + bio_init(&bio, spage->dev->bdev, &bvec, 1, REQ_OP_READ); + bio_add_page(&bio, spage->page, fs_info->sectorsize, 0); + bio.bi_iter.bi_sector = spage->physical >> 9; - btrfsic_check_bio(bio); - if (submit_bio_wait(bio)) { + btrfsic_check_bio(&bio); + if (submit_bio_wait(&bio)) { spage->io_error = 1; sblock->no_io_error_seen = 0; } - bio_put(bio); + bio_uninit(&bio); } if (sblock->no_io_error_seen) -- 2.30.2