]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - block/blk-integrity.c
block, libnvdimm, nvme: provide a built-in blk_integrity nop profile
[karo-tx-linux.git] / block / blk-integrity.c
index 5d339ae64d5637e12a43ecb4d0f6027f8ed35f2a..d69c5c79f98e71059827265531aba75a63458f74 100644 (file)
@@ -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 gendisk as being integrity-capable
  * @disk:      struct gendisk pointer to make integrity-aware
@@ -402,7 +413,7 @@ void blk_integrity_register(struct gendisk *disk, struct blk_integrity *template
        bi->flags = BLK_INTEGRITY_VERIFY | BLK_INTEGRITY_GENERATE |
                template->flags;
        bi->interval_exp = ilog2(queue_logical_block_size(disk->queue));
-       bi->profile = template->profile;
+       bi->profile = template->profile ? template->profile : &nop_profile;
        bi->tuple_size = template->tuple_size;
        bi->tag_size = template->tag_size;