]> www.infradead.org Git - users/hch/block.git/commitdiff
block: add a queue_has_disk helper
authorChristoph Hellwig <hch@lst.de>
Wed, 4 Aug 2021 06:55:44 +0000 (08:55 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 4 Aug 2021 07:28:58 +0000 (09:28 +0200)
Add a helper to check if a gendisk is associated with a request_queue.

Signed-off-by: Christoph Hellwig <hch@lst.de>
include/linux/blkdev.h

index ac3642c88a4d0605a7906914a90ae65ce1bfae11..96f3d9617cd8a5530e12bf6149c48018e1166304 100644 (file)
@@ -664,6 +664,7 @@ extern void blk_clear_pm_only(struct request_queue *q);
        dma_map_page_attrs(dev, (bv)->bv_page, (bv)->bv_offset, (bv)->bv_len, \
        (dir), (attrs))
 
+#define queue_has_disk(q)      ((q)->kobj.parent != NULL)
 #define queue_to_disk(q)       (dev_to_disk(kobj_to_dev((q)->kobj.parent)))
 
 static inline bool queue_is_mq(struct request_queue *q)