diff options
author | Dan Williams <dan.j.williams@intel.com> | 2015-10-21 13:20:29 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-10-21 16:43:45 -0400 |
commit | 4125a09b0a0d579ebace17f0e62b03ab9d5ab2f4 (patch) | |
tree | d2e073b3985850b1ea2a8e7ba9a414a6427f463f /block/blk-integrity.c | |
parent | 5a48fc147d7f2718a5c7e73bc8c4067235791fc1 (diff) |
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 <keith.busch@intel.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Suggested-by: Christoph Hellwig <hch@lst.de>
[hch: kill the local nvme nop profile as well]
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-integrity.c')
-rw-r--r-- | block/blk-integrity.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 5d339ae64d56..d69c5c79f98e 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c | |||
@@ -384,6 +384,17 @@ static struct kobj_type integrity_ktype = { | |||
384 | .sysfs_ops = &integrity_ops, | 384 | .sysfs_ops = &integrity_ops, |
385 | }; | 385 | }; |
386 | 386 | ||
387 | static int blk_integrity_nop_fn(struct blk_integrity_iter *iter) | ||
388 | { | ||
389 | return 0; | ||
390 | } | ||
391 | |||
392 | static struct blk_integrity_profile nop_profile = { | ||
393 | .name = "nop", | ||
394 | .generate_fn = blk_integrity_nop_fn, | ||
395 | .verify_fn = blk_integrity_nop_fn, | ||
396 | }; | ||
397 | |||
387 | /** | 398 | /** |
388 | * blk_integrity_register - Register a gendisk as being integrity-capable | 399 | * blk_integrity_register - Register a gendisk as being integrity-capable |
389 | * @disk: struct gendisk pointer to make integrity-aware | 400 | * @disk: struct gendisk pointer to make integrity-aware |
@@ -402,7 +413,7 @@ void blk_integrity_register(struct gendisk *disk, struct blk_integrity *template | |||
402 | bi->flags = BLK_INTEGRITY_VERIFY | BLK_INTEGRITY_GENERATE | | 413 | bi->flags = BLK_INTEGRITY_VERIFY | BLK_INTEGRITY_GENERATE | |
403 | template->flags; | 414 | template->flags; |
404 | bi->interval_exp = ilog2(queue_logical_block_size(disk->queue)); | 415 | bi->interval_exp = ilog2(queue_logical_block_size(disk->queue)); |
405 | bi->profile = template->profile; | 416 | bi->profile = template->profile ? template->profile : &nop_profile; |
406 | bi->tuple_size = template->tuple_size; | 417 | bi->tuple_size = template->tuple_size; |
407 | bi->tag_size = template->tag_size; | 418 | bi->tag_size = template->tag_size; |
408 | 419 | ||