null_blk: add memory_backed module parameter
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): CGME20220531185258uscas1p29fc501690df21576af035ef48af16daf@uscas1p2.samsung.com
PATCH 1/1 null_blk: add memory_backed module parameter
Allow the memory_backed option to be set via a module parameter. Currently memory-backed null_blk devices can only be created using configfs. Having a module parameter makes it easier to create these devices.
This patch was originally submitted by Akinobu Mita in 2020 but received no response. I modified the original patch to apply cleanly and reworded the documentation from the original patch.
--- Documentation/block/null_blk.rst | 8 ++++++++ drivers/block/null_blk/main.c | 5 +++++ 2 files changed, 13 insertions(+)
Documentation/block/null_blk.rst +8 -0
@@ -72,6 +72,14 @@ submit_queues=[1..nr_cpus]: Default: 1 hw_queue_depth=[0..qdepth]: Default: 64 The hardware queue depth of the device. +memory_backed=[0/1]: Default: 0 + Whether or not to use a memory buffer to respond to IO requests + + = ============================================= + 0 Transfer no data in response to IO requests + 1 Use a memory buffer to respond to IO requests + = ============================================= + Multi-queue specific parameters -------------------------------
drivers/block/null_blk/main.c +5 -0
@@ -203,6 +203,10 @@ static int g_hw_queue_depth = 64;module_param_named (hw_queue_depth, g_hw_queue_depth, int,0444 );MODULE_PARM_DESC (hw_queue_depth,"Queue depth for each hardware queue. Default: 64" ); +static bool g_memory_backed; +module_param_named (memory_backed, g_memory_backed, bool,0444 ); +MODULE_PARM_DESC (memory_backed,"Create a memory-backed block device. Default: false" ); +static bool g_use_per_node_hctx;module_param_named (use_per_node_hctx, g_use_per_node_hctx, bool,0444 );MODULE_PARM_DESC (use_per_node_hctx,"Use per-node allocation for hardware context queues. Default: false" );
@@ -656,6 +660,7 @@ static struct nullb_device *null_alloc_dev(void) dev->irqmode = g_irqmode; dev->hw_queue_depth = g_hw_queue_depth; dev->blocking = g_blocking; + dev->memory_backed = g_memory_backed; dev->use_per_node_hctx = g_use_per_node_hctx; dev->zoned = g_zoned; dev->zone_size = g_zone_size;
Signature · 1 line
2.25.1
Jens Axboe
maintainerQuoted 8 lines · Vincent Fu
Allow the
memory_backedoption to be set via a module parameter. Currently memory-backednull_blkdevices can only be created using configfs. Having a module parameter makes it easier to create these devices.This patch was originally submitted by Akinobu Mita in 2020 but received no response. I modified the original patch to apply cleanly and reworded the documentation from the original patch.
Ideally we'd have full parity between what can be set at module load time and configfs setup, doesn't really make any sense to have them not be identical.
Patch looks fine to me.
Signature · 1 line
Jens Axboe