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