All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] null_blk: add memory_backed module parameter
       [not found] <CGME20220531185258uscas1p29fc501690df21576af035ef48af16daf@uscas1p2.samsung.com>
@ 2022-05-31 18:52 ` Vincent Fu
  2022-05-31 19:01   ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Fu @ 2022-05-31 18:52 UTC (permalink / raw)
  To: axboe, linux-block; +Cc: Vincent Fu, Akinobu Mita

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.

Originally-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
---
 Documentation/block/null_blk.rst | 8 ++++++++
 drivers/block/null_blk/main.c    | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/Documentation/block/null_blk.rst b/Documentation/block/null_blk.rst
index edbbab2f1..618a491fa 100644
--- a/Documentation/block/null_blk.rst
+++ b/Documentation/block/null_blk.rst
@@ -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
 -------------------------------
 
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 539cfeac2..e97623c55 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -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;
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] null_blk: add memory_backed module parameter
  2022-05-31 18:52 ` [PATCH] null_blk: add memory_backed module parameter Vincent Fu
@ 2022-05-31 19:01   ` Jens Axboe
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2022-05-31 19:01 UTC (permalink / raw)
  To: Vincent Fu, linux-block; +Cc: Akinobu Mita

On 5/31/22 12:52 PM, Vincent Fu wrote:
> 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.

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.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] null_blk: add 'memory_backed' module parameter
@ 2020-03-25 15:40 Akinobu Mita
  0 siblings, 0 replies; 3+ messages in thread
From: Akinobu Mita @ 2020-03-25 15:40 UTC (permalink / raw)
  To: linux-block; +Cc: Akinobu Mita, Jens Axboe

Currently, the memory_backed feature is only enabled by the null block
device configured through configfs.
This adds module parameter to make device as a memory-backed block device,
and reduces a few steps required to test zonefs with zoned null block
device.

Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 Documentation/block/null_blk.rst | 3 +++
 drivers/block/null_blk_main.c    | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/Documentation/block/null_blk.rst b/Documentation/block/null_blk.rst
index edbbab2f12f8..036970121198 100644
--- a/Documentation/block/null_blk.rst
+++ b/Documentation/block/null_blk.rst
@@ -72,6 +72,9 @@ 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
+  Device is a memory-backed or no transfer block device.
+
 Multi-queue specific parameters
 -------------------------------
 
diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
index 133060431dbd..1ed2ccc5960b 100644
--- a/drivers/block/null_blk_main.c
+++ b/drivers/block/null_blk_main.c
@@ -177,6 +177,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, "Make device as 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");
@@ -551,6 +555,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;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-31 19:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20220531185258uscas1p29fc501690df21576af035ef48af16daf@uscas1p2.samsung.com>
2022-05-31 18:52 ` [PATCH] null_blk: add memory_backed module parameter Vincent Fu
2022-05-31 19:01   ` Jens Axboe
2020-03-25 15:40 [PATCH] null_blk: add 'memory_backed' " Akinobu Mita

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.