From: dan.j.williams@intel.com (Williams, Dan J)
Subject: [PATCH 2/5] block: Consolidate static integrity profile properties
Date: Wed, 14 Oct 2015 19:42:40 +0000 [thread overview]
Message-ID: <1444851760.3409.6.camel@intel.com> (raw)
In-Reply-To: <20151014072303.GA2544@infradead.org>
On Wed, 2015-10-14@00:23 -0700, Christoph Hellwig wrote:
> On Tue, Oct 13, 2015@06:11:50PM -0700, Dan Williams wrote:
> > > int nd_integrity_init(struct gendisk *disk, unsigned long meta_size)
> > > {
> > > - struct blk_integrity integrity = {
> > > + struct blk_integrity bi;
> > > + struct blk_integrity_profile profile = {
> > > .name = "ND-PI-NOP",
> > > .generate_fn = nd_pi_nop_generate_verify,
> > > .verify_fn = nd_pi_nop_generate_verify,
> > > - .tuple_size = meta_size,
> > > - .tag_size = meta_size,
> >
> > 'profile' here needs to be made static since we reference rather than
> > copy the profile data at blk_integrity_register() time. This is part
> > of, but I don't think all of, my blk_integrity shutdown woes.
>
> Oh, yes. Can we also add a single noop profile to block/blk-integrity.c
> while we're at it?
>
Sounds good, how about?
8<------
Subject: block, libnvdimm: provide a built-in blk_integrity nop profile
From: Dan Williams <dan.j.williams@intel.com>
The libnvidmm-btt driver uses blk_integrity to reserve space for
per-sector metadata, but does not implement protection checksums. This
property is generically useful, so teach the block core to internally
specify a nop profile if one is not provided at registration time.
Suggested-by: Christoph Hellwig <hch at lst.de>
Signed-off-by: Dan Williams <dan.j.williams at intel.com>
---
block/blk-integrity.c | 13 ++++++++++++-
drivers/nvdimm/core.c | 12 +-----------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index dc4dea7b8a93..506cc16c1a92 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -384,6 +384,17 @@ static struct kobj_type integrity_ktype = {
.sysfs_ops = &integrity_ops,
};
+static int blk_integrity_nop_fn(struct blk_integrity_iter *iter)
+{
+ return 0;
+}
+
+static struct blk_integrity_profile nop_profile = {
+ .name = "nop",
+ .generate_fn = blk_integrity_nop_fn,
+ .verify_fn = blk_integrity_nop_fn,
+};
+
/**
* blk_integrity_register - Register a request_queue as being integrity-capable
* @disk: struct request_queue pointer to make integrity-aware
@@ -402,7 +413,7 @@ void blk_integrity_register(struct request_queue *q, struct blk_integrity *templ
bi->flags = BLK_INTEGRITY_VERIFY | BLK_INTEGRITY_GENERATE |
template->flags;
bi->interval_exp = ilog2(queue_logical_block_size(q));
- bi->profile = template->profile;
+ bi->profile = template->profile ? template->profile : &nop_profile;
bi->tuple_size = template->tuple_size;
bi->tag_size = template->tag_size;
diff --git a/drivers/nvdimm/core.c b/drivers/nvdimm/core.c
index eeedd58bbcad..2ed3c934256f 100644
--- a/drivers/nvdimm/core.c
+++ b/drivers/nvdimm/core.c
@@ -392,24 +392,14 @@ void nvdimm_bus_unregister(struct nvdimm_bus *nvdimm_bus)
EXPORT_SYMBOL_GPL(nvdimm_bus_unregister);
#ifdef CONFIG_BLK_DEV_INTEGRITY
-static int nd_pi_nop_generate_verify(struct blk_integrity_iter *iter)
-{
- return 0;
-}
-
int nd_integrity_init(struct gendisk *disk, unsigned long meta_size)
{
struct blk_integrity bi;
- static struct blk_integrity_profile profile = {
- .name = "ND-PI-NOP",
- .generate_fn = nd_pi_nop_generate_verify,
- .verify_fn = nd_pi_nop_generate_verify,
- };
if (meta_size == 0)
return 0;
- bi.profile = &profile;
+ bi.profile = NULL;
bi.tuple_size = meta_size;
bi.tag_size = meta_size;
next prev parent reply other threads:[~2015-10-14 19:42 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-14 17:57 [PATCH] NVMe: Reread partitions on metadata formats Keith Busch
2015-07-14 18:49 ` Jens Axboe
2015-07-14 19:01 ` Paul Grabinar
2015-07-15 3:48 ` Dan Williams
2015-07-15 21:36 ` Jens Axboe
2015-07-15 22:28 ` Keith Busch
2015-07-16 9:19 ` Christoph Hellwig
2015-07-17 1:47 ` Martin K. Petersen
2015-07-17 9:30 ` Christoph Hellwig
2015-07-21 6:02 ` Data integrity tweaks Martin K. Petersen
2015-07-21 6:02 ` [PATCH 1/5] block: Move integrity kobject to struct gendisk Martin K. Petersen
2015-07-22 11:32 ` Sagi Grimberg
2015-07-21 6:02 ` [PATCH 2/5] block: Consolidate static integrity profile properties Martin K. Petersen
2015-07-22 11:33 ` Sagi Grimberg
2015-07-21 6:02 ` [PATCH 3/5] block: Reduce the size of struct blk_integrity Martin K. Petersen
2015-07-21 11:53 ` Christoph Hellwig
2015-07-24 15:14 ` Martin K. Petersen
2015-07-22 11:35 ` Sagi Grimberg
2015-07-21 6:02 ` [PATCH 4/5] block: Export integrity data interval size in sysfs Martin K. Petersen
2015-07-22 11:37 ` Sagi Grimberg
2015-07-24 15:26 ` Martin K. Petersen
2015-07-21 6:02 ` [PATCH 5/5] block: Inline blk_integrity in struct gendisk Martin K. Petersen
2015-07-21 12:01 ` Christoph Hellwig
2015-08-20 20:41 ` Simplify block integrity registration Martin K. Petersen
2015-08-20 20:41 ` [PATCH 1/5] block: Move integrity kobject to struct gendisk Martin K. Petersen
2015-09-16 17:26 ` Mike Snitzer
2015-09-16 17:26 ` Mike Snitzer
2015-08-20 20:41 ` [PATCH 2/5] block: Consolidate static integrity profile properties Martin K. Petersen
2015-08-20 20:41 ` [PATCH 3/5] block: Reduce the size of struct blk_integrity Martin K. Petersen
2015-08-20 20:41 ` [PATCH 4/5] block: Export integrity data interval size in sysfs Martin K. Petersen
2015-08-20 20:41 ` [PATCH 5/5] block: Inline blk_integrity in struct gendisk Martin K. Petersen
2015-08-21 23:47 ` Busch, Keith
2015-08-27 0:25 ` Martin K. Petersen
2015-08-27 0:25 ` [PATCH] " Martin K. Petersen
2015-08-27 8:28 ` Christoph Hellwig
2015-09-03 20:38 ` Keith Busch
2015-09-04 3:25 ` Martin K. Petersen
2015-10-12 21:05 ` Block integrity registration update Martin K. Petersen
2015-10-12 21:05 ` [PATCH 1/5] block: Move integrity kobject to struct gendisk Martin K. Petersen
2015-10-12 21:05 ` [PATCH 2/5] block: Consolidate static integrity profile properties Martin K. Petersen
2015-10-14 1:11 ` Dan Williams
2015-10-14 7:23 ` Christoph Hellwig
2015-10-14 19:42 ` Williams, Dan J [this message]
2015-10-14 19:47 ` hch
2015-10-14 20:00 ` Williams, Dan J
2015-10-14 22:42 ` Martin K. Petersen
2015-10-12 21:05 ` [PATCH 3/5] block: Reduce the size of struct blk_integrity Martin K. Petersen
2015-10-12 21:05 ` [PATCH 4/5] block: Export integrity data interval size in sysfs Martin K. Petersen
2015-10-12 21:05 ` [PATCH 5/5] block: Inline blk_integrity in struct gendisk Martin K. Petersen
2015-10-12 23:06 ` Mike Snitzer
2015-10-13 0:31 ` Block integrity registration update Williams, Dan J
2015-10-13 1:53 ` Williams, Dan J
2015-10-13 12:26 ` hch
2015-10-13 17:38 ` Dan Williams
2015-10-13 17:38 ` Dan Williams
2015-09-16 1:07 ` [PATCH 5/5] block: Inline blk_integrity in struct gendisk Mike Snitzer
2015-09-16 1:07 ` Mike Snitzer
2015-09-21 20:45 ` Mike Snitzer
2015-09-21 20:45 ` Mike Snitzer
2015-10-09 7:36 ` Christoph Hellwig
2015-10-09 7:36 ` Christoph Hellwig
2015-10-12 1:17 ` Martin K. Petersen
2015-10-12 1:17 ` Martin K. Petersen
2015-08-20 20:45 ` Simplify block integrity registration Mike Snitzer
2015-07-17 1:44 ` [PATCH] NVMe: Reread partitions on metadata formats Martin K. Petersen
2015-07-15 17:37 ` Paul Grabinar
-- strict thread matches above, loose matches on Subject: below --
2015-10-20 2:24 [PATCH v2 10/12] block: move blk_integrity to request_queue Martin K. Petersen
2015-10-20 2:45 ` Simplify block integrity registration v2 Martin K. Petersen
2015-10-20 2:45 ` [PATCH 2/5] block: Consolidate static integrity profile properties Martin K. Petersen
2015-10-20 18:20 ` Dan Williams
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=1444851760.3409.6.camel@intel.com \
--to=dan.j.williams@intel.com \
/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 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.