diff mbox series

[1/8] null_blk: add module parameter for REQ_OP_DISCARD

Message ID 20190711175328.16430-2-chaitanya.kulkarni@wdc.com (mailing list archive)
State New, archived
Headers show
Series null_blk: add missing write-zeroes and discard support | expand

Commit Message

Chaitanya Kulkarni July 11, 2019, 5:53 p.m. UTC
This patch adds a module parameter to configure the REQ_OP_DISCARD
handling support when null_blk module is not memory-backed. This support
is useful in the various scenarios such as examining REQ_OP_DISCARD path
tests, blktrace and discard with priorities.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/block/null_blk_main.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Minwoo Im July 28, 2019, 6:04 a.m. UTC | #1
Hi Chaitanya,

On 19-07-11 10:53:21, Chaitanya Kulkarni wrote:
> This patch adds a module parameter to configure the REQ_OP_DISCARD
> handling support when null_blk module is not memory-backed. This support
> is useful in the various scenarios such as examining REQ_OP_DISCARD path
> tests, blktrace and discard with priorities.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  drivers/block/null_blk_main.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
> index 99328ded60d1..20d60b951622 100644
> --- a/drivers/block/null_blk_main.c
> +++ b/drivers/block/null_blk_main.c
> @@ -3,6 +3,7 @@
>   * Add configfs and memory store: Kyungchan Koh <kkc6196@fb.com> and
>   * Shaohua Li <shli@fb.com>
>   */
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

Maybe it casue other pr_ family prints "null_blk" twice, doesn't it?  If
so, can we have this change with the other pr_ family updated?

Thanks!
Chaitanya Kulkarni July 30, 2019, 4:48 a.m. UTC | #2
On 7/27/19 11:04 PM, Minwoo Im wrote:
> Hi Chaitanya,
>
> On 19-07-11 10:53:21, Chaitanya Kulkarni wrote:
>> This patch adds a module parameter to configure the REQ_OP_DISCARD
>> handling support when null_blk module is not memory-backed. This support
>> is useful in the various scenarios such as examining REQ_OP_DISCARD path
>> tests, blktrace and discard with priorities.
>>
>> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
>> ---
>>  drivers/block/null_blk_main.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
>> index 99328ded60d1..20d60b951622 100644
>> --- a/drivers/block/null_blk_main.c
>> +++ b/drivers/block/null_blk_main.c
>> @@ -3,6 +3,7 @@
>>   * Add configfs and memory store: Kyungchan Koh <kkc6196@fb.com> and
>>   * Shaohua Li <shli@fb.com>
>>   */
>> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> Maybe it casue other pr_ family prints "null_blk" twice, doesn't it?  If
> so, can we have this change with the other pr_ family updated?
>
> Thanks!
>
Okay, I'll add this in next version.
diff mbox series

Patch

diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
index 99328ded60d1..20d60b951622 100644
--- a/drivers/block/null_blk_main.c
+++ b/drivers/block/null_blk_main.c
@@ -3,6 +3,7 @@ 
  * Add configfs and memory store: Kyungchan Koh <kkc6196@fb.com> and
  * Shaohua Li <shli@fb.com>
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/module.h>
 
 #include <linux/moduleparam.h>
@@ -193,6 +194,10 @@  static unsigned int g_zone_nr_conv;
 module_param_named(zone_nr_conv, g_zone_nr_conv, uint, 0444);
 MODULE_PARM_DESC(zone_nr_conv, "Number of conventional zones when block device is zoned. Default: 0");
 
+static bool g_discard;
+module_param_named(discard, g_discard, bool, 0444);
+MODULE_PARM_DESC(discard, "Allow REQ_OP_DISCARD processing. Default: false");
+
 static struct nullb_device *null_alloc_dev(void);
 static void null_free_dev(struct nullb_device *dev);
 static void null_del_dev(struct nullb *nullb);
@@ -529,6 +534,8 @@  static struct nullb_device *null_alloc_dev(void)
 	dev->zoned = g_zoned;
 	dev->zone_size = g_zone_size;
 	dev->zone_nr_conv = g_zone_nr_conv;
+	dev->discard = g_discard;
+	pr_info("discard : %s\n", dev->discard ? "TRUE" : "FALSE");
 	return dev;
 }