diff options
| author | Christoph Hellwig <hch@lst.de> | 2025-04-28 07:09:48 -0700 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2025-04-28 11:45:40 -0600 |
| commit | 857aba38b56a0d8fa868706c57053dcd4282e436 (patch) | |
| tree | 8458e0c5651172d237028b5307720f21e9b07726 /drivers/block/brd.c | |
| parent | 75d99aa279561fc6d91afec8bdd1b56548f860a2 (diff) | |
| download | linux-next-857aba38b56a0d8fa868706c57053dcd4282e436.tar.gz linux-next-857aba38b56a0d8fa868706c57053dcd4282e436.zip | |
brd: remove the sector variable in brd_submit_bio
The bvec iter iterates over the sector already, no need to duplicate the
work.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20250428141014.2360063-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/brd.c')
| -rw-r--r-- | drivers/block/brd.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/block/brd.c b/drivers/block/brd.c index c8974bc545fb..91eb50126355 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c @@ -241,12 +241,12 @@ static void brd_do_discard(struct brd_device *brd, sector_t sector, u32 size) static void brd_submit_bio(struct bio *bio) { struct brd_device *brd = bio->bi_bdev->bd_disk->private_data; - sector_t sector = bio->bi_iter.bi_sector; struct bio_vec bvec; struct bvec_iter iter; if (unlikely(op_is_discard(bio->bi_opf))) { - brd_do_discard(brd, sector, bio->bi_iter.bi_size); + brd_do_discard(brd, bio->bi_iter.bi_sector, + bio->bi_iter.bi_size); bio_endio(bio); return; } @@ -254,7 +254,7 @@ static void brd_submit_bio(struct bio *bio) bio_for_each_segment(bvec, bio, iter) { int err; - err = brd_rw_bvec(brd, &bvec, bio->bi_opf, sector); + err = brd_rw_bvec(brd, &bvec, bio->bi_opf, iter.bi_sector); if (err) { if (err == -ENOMEM && bio->bi_opf & REQ_NOWAIT) { bio_wouldblock_error(bio); @@ -263,7 +263,6 @@ static void brd_submit_bio(struct bio *bio) bio_io_error(bio); return; } - sector += bvec.bv_len >> SECTOR_SHIFT; } bio_endio(bio); |
