On 1/11/24 9:06 AM, Christoph Hellwig wrote: > On Thu, Jan 11, 2024 at 09:00:20AM -0700, Jens Axboe wrote: >> 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); > > Is this really so much better vs just checking for bi->profile > being non-NULL? Before we can check that, we have to load bio->bi_bdev->bd_disk->queue->integrity, and we have to call in to bio_integrity_prep() as well needlessly. We could do that in patch 3 and then we just need to load q->integrity->profile, and while queue_flags is certainly hot, it's probably not a huge deal to load that cacheline. I think if we do that, we stick integrity before limits. I can make that change, and then we can drop the flag. -- Jens Axboe