Skip to content

Commit 9e0c829

Browse files
Bart Van Asscheaxboe
authored andcommitted
block: Add a comment above queue_lockdep_assert_held()
Add a comment above the queue_lockdep_assert_held() macro that explains the purpose of the q->queue_lock test. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.com> Cc: Omar Sandoval <osandov@fb.com> Cc: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent c3a148d commit 9e0c829

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎include/linux/blkdev.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,13 @@ struct request_queue {
635635
(1 << QUEUE_FLAG_SAME_COMP) | \
636636
(1 << QUEUE_FLAG_POLL))
637637

638+
/*
639+
* @q->queue_lock is set while a queue is being initialized. Since we know
640+
* that no other threads access the queue object before @q->queue_lock has
641+
* been set, it is safe to manipulate queue flags without holding the
642+
* queue_lock if @q->queue_lock == NULL. See also blk_alloc_queue_node() and
643+
* blk_init_allocated_queue().
644+
*/
638645
static inline void queue_lockdep_assert_held(struct request_queue *q)
639646
{
640647
if (q->queue_lock)

0 commit comments

Comments
 (0)