block: Add a comment above queue_lockdep_assert_held()
authorBart Van Assche <bart.vanassche@sandisk.com>
Tue, 20 Jun 2017 18:15:44 +0000 (11:15 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 21 Jun 2017 01:27:14 +0000 (19:27 -0600)
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>
include/linux/blkdev.h

index 9a36164487d086901dae9d773890eccbe421dfcc..3e60e7a654bda1e30d80a520ed16d4bcb0e8a872 100644 (file)
@@ -635,6 +635,13 @@ struct request_queue {
                                 (1 << QUEUE_FLAG_SAME_COMP)    |       \
                                 (1 << QUEUE_FLAG_POLL))
 
+/*
+ * @q->queue_lock is set while a queue is being initialized. Since we know
+ * that no other threads access the queue object before @q->queue_lock has
+ * been set, it is safe to manipulate queue flags without holding the
+ * queue_lock if @q->queue_lock == NULL. See also blk_alloc_queue_node() and
+ * blk_init_allocated_queue().
+ */
 static inline void queue_lockdep_assert_held(struct request_queue *q)
 {
        if (q->queue_lock)