]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: use bdev_rw_virt in scrub_one_super
authorChristoph Hellwig <hch@lst.de>
Wed, 7 May 2025 12:04:42 +0000 (14:04 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 7 May 2025 13:31:07 +0000 (07:31 -0600)
Replace the code building a bio from a kernel direct map address and
submitting it synchronously with the bdev_rw_virt helper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: David Sterba <dsterba@suse.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Link: https://lore.kernel.org/r/20250507120451.4000627-19-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/btrfs/scrub.c

index 2c5edcee94502b0625671137f856e385eb1aa26f..7bdb2bc0a21251a12ce406cb39b8862815952fec 100644 (file)
@@ -2770,17 +2770,11 @@ static int scrub_one_super(struct scrub_ctx *sctx, struct btrfs_device *dev,
                           struct page *page, u64 physical, u64 generation)
 {
        struct btrfs_fs_info *fs_info = sctx->fs_info;
-       struct bio_vec bvec;
-       struct bio bio;
        struct btrfs_super_block *sb = page_address(page);
        int ret;
 
-       bio_init(&bio, dev->bdev, &bvec, 1, REQ_OP_READ);
-       bio.bi_iter.bi_sector = physical >> SECTOR_SHIFT;
-       __bio_add_page(&bio, page, BTRFS_SUPER_INFO_SIZE, 0);
-       ret = submit_bio_wait(&bio);
-       bio_uninit(&bio);
-
+       ret = bdev_rw_virt(dev->bdev, physical >> SECTOR_SHIFT, sb,
+                       BTRFS_SUPER_INFO_SIZE, REQ_OP_READ);
        if (ret < 0)
                return ret;
        ret = btrfs_check_super_csum(fs_info, sb);