Skip to content

Commit 1645fc1

Browse files
morbidrsagregkh
authored andcommitted
block: only update request sector if needed
[ Upstream commit db492e2 ] In case of a ZONE APPEND write, regardless of native ZONE APPEND or the emulation layer in the zone write plugging code, the sector the data got written to by the device needs to be updated in the bio. At the moment, this is done for every native ZONE APPEND write and every request that is flagged with 'BIO_ZONE_WRITE_PLUGGING'. But thus superfluously updates the sector for regular writes to a zoned block device. Check if a bio is a native ZONE APPEND write or if the bio is flagged as 'BIO_EMULATES_ZONE_APPEND', meaning the block layer's zone write plugging code handles the ZONE APPEND and translates it into a regular write and back. Only if one of these two criterion is met, update the sector in the bio upon completion. Signed-off-by: Johannes Thumshirn <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/dea089581cb6b777c1cd1500b38ac0b61df4b2d1.1746530748.git.jth@kernel.org Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 511ea82 commit 1645fc1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

block/blk.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,8 @@ static inline void blk_zone_update_request_bio(struct request *rq,
482482
* the original BIO sector so that blk_zone_write_plug_bio_endio() can
483483
* lookup the zone write plug.
484484
*/
485-
if (req_op(rq) == REQ_OP_ZONE_APPEND || bio_zone_write_plugging(bio))
485+
if (req_op(rq) == REQ_OP_ZONE_APPEND ||
486+
bio_flagged(bio, BIO_EMULATES_ZONE_APPEND))
486487
bio->bi_iter.bi_sector = rq->__sector;
487488
}
488489
void blk_zone_write_plug_bio_endio(struct bio *bio);

0 commit comments

Comments
 (0)