]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
zloop: add max_open_zones option
authorDamien Le Moal <dlemoal@kernel.org>
Thu, 26 Mar 2026 20:32:45 +0000 (05:32 +0900)
committerJens Axboe <axboe@kernel.dk>
Tue, 31 Mar 2026 14:33:28 +0000 (08:33 -0600)
commitb2a78fec344ead9ffca63ee13018f482392bf09d
tree04a732195a0def13728aa8380d6a68e611df5df3
parent2a2f520fda824b5a25c93f2249578ea150c24e06
zloop: add max_open_zones option

Introduce the new max_open_zones option to allow specifying a limit on
the maximum number of open zones of a zloop device. This change allows
creating a zloop device that can more closely mimick the characteristics
of a physical SMR drive.

When set to a non zero value, only up to max_open_zones zones can be in
the implicit open (BLK_ZONE_COND_IMP_OPEN) and explicit open
(BLK_ZONE_COND_EXP_OPEN) conditions at any time. The transition to the
implicit open condition of a zone on a write operation can result in an
implicit close of an already implicitly open zone. This is handled in
the function zloop_do_open_zone(). This function also handles
transitions to the explicit open condition. Implicit close transitions
are handled using an LRU ordered list of open zones which is managed
using the helper functions zloop_lru_rotate_open_zone() and
zloop_lru_remove_open_zone().

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20260326203245.946830-1-dlemoal@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Documentation/admin-guide/blockdev/zoned_loop.rst
drivers/block/zloop.c