block: Fix zone write plug initialization from blk_revalidate_zone_cb()
authorDamien Le Moal <dlemoal@kernel.org>
Wed, 1 May 2024 11:08:56 +0000 (20:08 +0900)
committerJens Axboe <axboe@kernel.dk>
Wed, 1 May 2024 14:08:42 +0000 (08:08 -0600)
commit74b7ae5f48e6f9518a32f50926619eba54be44de
tree9efc694ce43ff4e5e70c7035dd3af132de6ec9fe
parent6b7593b5fb9eb73be92f78a1abfa502f05ff5e15
block: Fix zone write plug initialization from blk_revalidate_zone_cb()

When revalidating the zones of a zoned block device,
blk_revalidate_zone_cb() must allocate a zone write plug for any
sequential write required zone that is not empty nor full. However, the
current code tests the latter case by comparing the zone write pointer
offset to the zone size instead of the zone capacity. Furthermore,
disk_get_and_lock_zone_wplug() is called with a sector argument equal to
the zone start instead of the current zone write pointer position.
This commit fixes both issues by calling disk_get_and_lock_zone_wplug()
for a zone that is not empty and with a write pointer offset lower than
the zone capacity and use the zone capacity sector as the sector
argument for disk_get_and_lock_zone_wplug().

Fixes: dd291d77cc90 ("block: Introduce zone write plugging")
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20240501110907.96950-4-dlemoal@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-zoned.c