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

@ -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;