block, libnvdimm, nvme: provide a built-in blk_integrity nop profile

The libnvidmm-btt and nvme drivers use blk_integrity to reserve space
for per-sector metadata, but sometimes without 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.

Cc: Keith Busch <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Suggested-by: Christoph Hellwig <[email protected]>
[hch: kill the local nvme nop profile as well]
Acked-by: Martin K. Petersen <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
Dan Williams 2015-10-21 13:20:29 -04:00 • committed by Jens Axboe
commit 4125a09b0a
3 changed files with 14 additions and 29 deletions

View file

@ -548,22 +548,6 @@ static void nvme_dif_remap(struct request *req,
kunmap_atomic(pmap);
}
static int nvme_noop_verify(struct blk_integrity_iter *iter)
{
return 0;
}
static int nvme_noop_generate(struct blk_integrity_iter *iter)
{
return 0;
}
struct blk_integrity_profile nvme_meta_noop = {
.name = "NVME_META_NOOP",
.generate_fn = nvme_noop_generate,
.verify_fn = nvme_noop_verify,
};
static void nvme_init_integrity(struct nvme_ns *ns)
{
struct blk_integrity integrity;
@ -577,7 +561,7 @@ static void nvme_init_integrity(struct nvme_ns *ns)
integrity.profile = &t10_pi_type1_crc;
break;
default:
integrity.profile = &nvme_meta_noop;
integrity.profile = NULL;
break;
}
integrity.tuple_size = ns->ms;