Now that we don't set a dummy profile, if someone registers and actual profile, flag the queue as such. Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> --- block/blk-integrity.c | 14 +++++++++----- include/linux/blkdev.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/block/blk-integrity.c b/block/blk-integrity.c index a1ea1794c7c8..974af93de2da 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -339,22 +339,25 @@ const struct attribute_group blk_integrity_attr_group = { */ void blk_integrity_register(struct gendisk *disk, struct blk_integrity *template) { - struct blk_integrity *bi = &disk->queue->integrity; + struct request_queue *q = disk->queue; + struct blk_integrity *bi = &q->integrity; bi->flags = BLK_INTEGRITY_VERIFY | BLK_INTEGRITY_GENERATE | template->flags; bi->interval_exp = template->interval_exp ? : - ilog2(queue_logical_block_size(disk->queue)); + ilog2(queue_logical_block_size(q)); bi->profile = template->profile; + if (bi->profile) + blk_queue_flag_set(QUEUE_FLAG_INTG_PROFILE, q); bi->tuple_size = template->tuple_size; bi->tag_size = template->tag_size; - blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, disk->queue); + blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, q); #ifdef CONFIG_BLK_INLINE_ENCRYPTION - if (disk->queue->crypto_profile) { + if (q->crypto_profile) { pr_warn("blk-integrity: Integrity and hardware inline encryption are not supported together. Disabling hardware inline encryption.\n"); - disk->queue->crypto_profile = NULL; + q->crypto_profile = NULL; } #endif } @@ -377,6 +380,7 @@ void blk_integrity_unregister(struct gendisk *disk) /* ensure all bios are off the integrity workqueue */ blk_flush_integrity(); blk_queue_flag_clear(QUEUE_FLAG_STABLE_WRITES, disk->queue); + blk_queue_flag_clear(QUEUE_FLAG_INTG_PROFILE, disk->queue); memset(bi, 0, sizeof(*bi)); } EXPORT_SYMBOL(blk_integrity_unregister); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index e1e705aef51e..de81642831bb 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -510,6 +510,7 @@ struct request_queue { /* Keep blk_queue_flag_name[] in sync with the definitions below */ #define QUEUE_FLAG_STOPPED 0 /* queue is stopped */ #define QUEUE_FLAG_DYING 1 /* queue being torn down */ +#define QUEUE_FLAG_INTG_PROFILE 2 /* has integrity profile */ #define QUEUE_FLAG_NOMERGES 3 /* disable merge attempts */ #define QUEUE_FLAG_SAME_COMP 4 /* complete on same CPU-group */ #define QUEUE_FLAG_FAIL_IO 5 /* fake timeout */ -- 2.43.0