mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 15:03:53 +02:00
block: new zoned loop block device driver
The zoned loop block device driver allows a user to create emulated zoned block devices using one regular file per zone as backing storage. Compared to null_blk or scsi_debug, it has the advantage of allowing emulating large zoned devices without requiring the same amount of memory as the capacity of the emulated device. Furthermore, zoned devices emulated with this driver can be re-started after a host reboot without any loss of the state of the device zones, which is something that null_blk and scsi_debug do not support. This initial implementation is simple and does not support zone resource limits. That is, a zoned loop block device limits for the maximum number of open zones and maximum number of active zones is always 0. This driver can be either compiled in-kernel or as a module, named "zloop". Compilation of this driver depends on the block layer support for zoned block device (CONFIG_BLK_DEV_ZONED must be set). Using the zloop driver to create and delete zoned block devices is done by writing commands to the zoned loop control character device file (/dev/zloop-control). Creating a device is done with: $ echo "add [options]" > /dev/zloop-control The options available for the "add" operation cat be listed by reading the zloop-control device file: $ cat /dev/zloop-control add id=%d,capacity_mb=%u,zone_size_mb=%u,zone_capacity_mb=%u,conv_zones=%u,base_dir=%s,nr_queues=%u,queue_depth=%u remove id=%d The options available allow controlling the zoned device total capacity, zone size, zone capactity of sequential zones, total number of conventional zones, base directory for the zones backing file, number of I/O queues and the maximum queue depth of I/O queues. Deleting a device is done using the "remove" command: $ echo "remove id=0" > /dev/zloop-control This implementation passes various tests using zonefs and fio (t/zbd tests) and provides a state machine for zone conditions that is compliant with the T10 ZBC and NVMe ZNS specifications. Co-developed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Link: https://lore.kernel.org/r/20250407075222.170336-2-dlemoal@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
53ec1abce7
commit
eb0570c7df
|
@ -26723,6 +26723,13 @@ L: linux-kernel@vger.kernel.org
|
|||
S: Maintained
|
||||
F: arch/x86/kernel/cpu/zhaoxin.c
|
||||
|
||||
ZONED LOOP DEVICE
|
||||
M: Damien Le Moal <dlemoal@kernel.org>
|
||||
R: Christoph Hellwig <hch@lst.de>
|
||||
L: linux-block@vger.kernel.org
|
||||
S: Maintained
|
||||
F: drivers/block/zloop.c
|
||||
|
||||
ZONEFS FILESYSTEM
|
||||
M: Damien Le Moal <dlemoal@kernel.org>
|
||||
M: Naohiro Aota <naohiro.aota@wdc.com>
|
||||
|
|
|
@ -407,4 +407,20 @@ config BLKDEV_UBLK_LEGACY_OPCODES
|
|||
|
||||
source "drivers/block/rnbd/Kconfig"
|
||||
|
||||
config BLK_DEV_ZONED_LOOP
|
||||
tristate "Zoned loopback device support"
|
||||
depends on BLK_DEV_ZONED
|
||||
help
|
||||
Saying Y here will allow you to use create a zoned block device using
|
||||
regular files for zones (one file per zones). This is useful to test
|
||||
file systems, device mapper and applications that support zoned block
|
||||
devices. To create a zoned loop device, no user utility is needed, a
|
||||
zoned loop device can be created (or re-started) using a command
|
||||
like:
|
||||
|
||||
echo "add id=0,zone_size_mb=256,capacity_mb=16384,conv_zones=11" > \
|
||||
/dev/zloop-control
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
endif # BLK_DEV
|
||||
|
|
|
@ -41,5 +41,6 @@ obj-$(CONFIG_BLK_DEV_RNBD) += rnbd/
|
|||
obj-$(CONFIG_BLK_DEV_NULL_BLK) += null_blk/
|
||||
|
||||
obj-$(CONFIG_BLK_DEV_UBLK) += ublk_drv.o
|
||||
obj-$(CONFIG_BLK_DEV_ZONED_LOOP) += zloop.o
|
||||
|
||||
swim_mod-y := swim.o swim_asm.o
|
||||
|
|
1385
drivers/block/zloop.c
Normal file
1385
drivers/block/zloop.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user