null_blk: Improve implicit zone close
authorDamien Le Moal <damien.lemoal@wdc.com>
Fri, 20 Nov 2020 01:55:15 +0000 (10:55 +0900)
committerJens Axboe <axboe@kernel.dk>
Tue, 8 Dec 2020 00:36:03 +0000 (17:36 -0700)
commit2e8c6e0e1d2d65562c637940747cfa30559f976a
tree7dbdf01e308099b11ea6ffd07be39ab4fcef2c9e
parent2b8b7ed7f3fc2b1536a0add3941ae159529d23bd
null_blk: Improve implicit zone close

When open zone resource management is enabled, that is, when a null_blk
zoned device is created with zone_max_open different than 0, implicitly
or explicitly opening a zone may require implicitly closing a zone
that is already implicitly open. This operation is done using the
function null_close_first_imp_zone(), which search for an implicitly
open zone to close starting from the first sequential zone. This
implementation is simple but may result in the same being constantly
implicitly closed and then implicitly reopened on write, namely, the
lowest numbered zone that is being written.

Avoid this by starting the search for an implicitly open zone starting
from the zone following the last zone that was implicitly closed. The
function null_close_first_imp_zone() is renamed
null_close_imp_open_zone().

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/null_blk.h
drivers/block/null_blk_zoned.c