From: Chaitanya Kulkarni <kch@nvidia.com>
To: <linux-block@vger.kernel.org>, <linux-raid@vger.kernel.org>,
<linux-nvme@lists.infradead.org>, <linux-fsdevel@vger.kernel.org>
Cc: <axboe@kernel.dk>, <agk@redhat.com>, <song@kernel.org>,
<djwong@kernel.org>, <kbusch@kernel.org>, <hch@lst.de>,
<sagi@grimberg.me>, <jejb@linux.ibm.com>,
<martin.petersen@oracle.com>, <viro@zeniv.linux.org.uk>,
<javier@javigon.com>, <johannes.thumshirn@wdc.com>,
<bvanassche@acm.org>, <dongli.zhang@oracle.com>,
<ming.lei@redhat.com>, <willy@infradead.org>,
<jefflexu@linux.alibaba.com>, <josef@toxicpanda.com>,
<clm@fb.com>, <dsterba@suse.com>, <jack@suse.com>,
<tytso@mit.edu>, <adilger.kernel@dilger.ca>, <jlayton@kernel.org>,
<idryomov@gmail.com>, <danil.kipnis@cloud.ionos.com>,
<ebiggers@google.com>, <jinpu.wang@cloud.ionos.com>,
Chaitanya Kulkarni <kch@nvidia.com>
Subject: [PATCH 6/6] null_blk: add REQ_OP_VERIFY support
Date: Thu, 30 Jun 2022 02:14:06 -0700 [thread overview]
Message-ID: <20220630091406.19624-7-kch@nvidia.com> (raw)
In-Reply-To: <20220630091406.19624-1-kch@nvidia.com>
Add a new module parameter, configfs attribute to configure handling of
the REQ_OP_VERIFY. This is needed for testing newly added REQ_OP_VERIFY
block layer operation.
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
drivers/block/null_blk/main.c | 20 +++++++++++++++++++-
drivers/block/null_blk/null_blk.h | 1 +
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 6b67088f4ea7..559daac83b94 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -77,6 +77,10 @@ enum {
NULL_IRQ_TIMER = 2,
};
+static bool g_verify = true;
+module_param_named(verify, g_verify, bool, 0444);
+MODULE_PARM_DESC(verify, "Allow REQ_OP_VERIFY processing. Default: true");
+
static bool g_virt_boundary = false;
module_param_named(virt_boundary, g_virt_boundary, bool, 0444);
MODULE_PARM_DESC(virt_boundary, "Require a virtual boundary for the device. Default: False");
@@ -400,6 +404,7 @@ NULLB_DEVICE_ATTR(blocking, bool, NULL);
NULLB_DEVICE_ATTR(use_per_node_hctx, bool, NULL);
NULLB_DEVICE_ATTR(memory_backed, bool, NULL);
NULLB_DEVICE_ATTR(discard, bool, NULL);
+NULLB_DEVICE_ATTR(verify, bool, NULL);
NULLB_DEVICE_ATTR(mbps, uint, NULL);
NULLB_DEVICE_ATTR(cache_size, ulong, NULL);
NULLB_DEVICE_ATTR(zoned, bool, NULL);
@@ -522,6 +527,7 @@ static struct configfs_attribute *nullb_device_attrs[] = {
&nullb_device_attr_power,
&nullb_device_attr_memory_backed,
&nullb_device_attr_discard,
+ &nullb_device_attr_verify,
&nullb_device_attr_mbps,
&nullb_device_attr_cache_size,
&nullb_device_attr_badblocks,
@@ -588,7 +594,7 @@ nullb_group_drop_item(struct config_group *group, struct config_item *item)
static ssize_t memb_group_features_show(struct config_item *item, char *page)
{
return snprintf(page, PAGE_SIZE,
- "memory_backed,discard,bandwidth,cache,badblocks,zoned,zone_size,zone_capacity,zone_nr_conv,zone_max_open,zone_max_active,blocksize,max_sectors,virt_boundary\n");
+ "memory_backed,discard,verify,bandwidth,cache,badblocks,zoned,zone_size,zone_capacity,zone_nr_conv,zone_max_open,zone_max_active,blocksize,max_sectors,virt_boundary\n");
}
CONFIGFS_ATTR_RO(memb_group_, features);
@@ -651,6 +657,7 @@ static struct nullb_device *null_alloc_dev(void)
dev->hw_queue_depth = g_hw_queue_depth;
dev->blocking = g_blocking;
dev->use_per_node_hctx = g_use_per_node_hctx;
+ dev->verify = g_verify;
dev->zoned = g_zoned;
dev->zone_size = g_zone_size;
dev->zone_capacity = g_zone_capacity;
@@ -1394,6 +1401,10 @@ blk_status_t null_process_cmd(struct nullb_cmd *cmd,
return ret;
}
+ /* currently implemented as noop */
+ if (op == REQ_OP_VERIFY)
+ return 0;
+
if (dev->memory_backed)
return null_handle_memory_backed(cmd, op, sector, nr_sectors);
@@ -1769,6 +1780,12 @@ static void null_config_discard(struct nullb *nullb)
blk_queue_max_discard_sectors(nullb->q, UINT_MAX >> 9);
}
+static void null_config_verify(struct nullb *nullb)
+{
+ blk_queue_max_verify_sectors(nullb->q,
+ nullb->dev->verify ? UINT_MAX >> 9 : 0);
+}
+
static const struct block_device_operations null_bio_ops = {
.owner = THIS_MODULE,
.submit_bio = null_submit_bio,
@@ -2059,6 +2076,7 @@ static int null_add_dev(struct nullb_device *dev)
blk_queue_virt_boundary(nullb->q, PAGE_SIZE - 1);
null_config_discard(nullb);
+ null_config_verify(nullb);
if (config_item_name(&dev->item)) {
/* Use configfs dir name as the device name */
diff --git a/drivers/block/null_blk/null_blk.h b/drivers/block/null_blk/null_blk.h
index 8359b43842f2..2a1df1bc8165 100644
--- a/drivers/block/null_blk/null_blk.h
+++ b/drivers/block/null_blk/null_blk.h
@@ -111,6 +111,7 @@ struct nullb_device {
bool power; /* power on/off the device */
bool memory_backed; /* if data is stored in memory */
bool discard; /* if support discard */
+ bool verify; /* if support verify */
bool zoned; /* if device is zoned */
bool virt_boundary; /* virtual boundary on/off for the device */
};
--
2.29.0
next prev parent reply other threads:[~2022-06-30 9:17 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-30 9:14 [PATCH 0/6] block: add support for REQ_OP_VERIFY Chaitanya Kulkarni
2022-06-30 9:14 ` [PATCH 1/6] " Chaitanya Kulkarni
2022-06-30 16:18 ` Darrick J. Wong
2022-07-05 16:50 ` Chaitanya Kulkarni
2022-07-05 17:57 ` Darrick J. Wong
2022-07-06 1:32 ` Chaitanya Kulkarni
2022-07-05 8:34 ` Christoph Hellwig
2022-07-05 23:55 ` Chaitanya Kulkarni
2022-06-30 9:14 ` [PATCH 2/6] nvme: add support for the Verify command Chaitanya Kulkarni
2022-06-30 16:24 ` Keith Busch
2022-07-05 8:34 ` Christoph Hellwig
2022-07-05 23:56 ` Chaitanya Kulkarni
2022-06-30 9:14 ` [PATCH 3/6] nvmet: add Verify command support for bdev-ns Chaitanya Kulkarni
2022-06-30 9:14 ` [PATCH 4/6] nvmet: add Verify emulation " Chaitanya Kulkarni
2022-07-05 8:35 ` Christoph Hellwig
2022-07-06 0:00 ` Chaitanya Kulkarni
2022-06-30 9:14 ` [PATCH 5/6] nvmet: add verify emulation support for file-ns Chaitanya Kulkarni
2022-07-05 8:36 ` Christoph Hellwig
2022-07-06 0:06 ` Chaitanya Kulkarni
2022-06-30 9:14 ` Chaitanya Kulkarni [this message]
2022-07-05 8:38 ` [PATCH 0/6] block: add support for REQ_OP_VERIFY Christoph Hellwig
2022-07-05 16:47 ` Chaitanya Kulkarni
2022-07-06 17:42 ` Matthew Wilcox
2022-07-13 9:14 ` Chaitanya Kulkarni
2022-07-13 9:36 ` Johannes Thumshirn
2022-07-13 12:17 ` Matthew Wilcox
2022-07-13 14:04 ` Keith Busch
2022-12-01 18:12 ` Chaitanya Kulkarni
2022-12-01 19:39 ` Matthew Wilcox
2022-12-02 7:16 ` Hannes Reinecke
2022-12-02 14:58 ` Keith Busch
2022-12-02 17:33 ` Clay Mayers
2022-12-02 18:58 ` Keith Busch
2022-12-09 4:52 ` Martin K. Petersen
2022-12-10 13:06 ` Carlos Carvalho
2022-12-12 6:30 ` hch
2022-12-03 4:19 ` Javier González
2022-12-04 20:29 ` Keith Busch
2022-12-08 20:06 ` Javier González
2022-12-08 20:02 ` Matthew Wilcox
2022-12-02 7:13 ` Hannes Reinecke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220630091406.19624-7-kch@nvidia.com \
--to=kch@nvidia.com \
--cc=adilger.kernel@dilger.ca \
--cc=agk@redhat.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=clm@fb.com \
--cc=danil.kipnis@cloud.ionos.com \
--cc=djwong@kernel.org \
--cc=dongli.zhang@oracle.com \
--cc=dsterba@suse.com \
--cc=ebiggers@google.com \
--cc=hch@lst.de \
--cc=idryomov@gmail.com \
--cc=jack@suse.com \
--cc=javier@javigon.com \
--cc=jefflexu@linux.alibaba.com \
--cc=jejb@linux.ibm.com \
--cc=jinpu.wang@cloud.ionos.com \
--cc=jlayton@kernel.org \
--cc=johannes.thumshirn@wdc.com \
--cc=josef@toxicpanda.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-raid@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ming.lei@redhat.com \
--cc=sagi@grimberg.me \
--cc=song@kernel.org \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).