[PATCH 04/23][SRU][OEM-5.14] block: add a queue_has_disk helper

Koba Ko koba.ko at canonical.com
Fri Jan 28 03:25:51 UTC 2022


From: Christoph Hellwig <hch at lst.de>

BugLink: https://bugs.launchpad.net/bugs/1958850 

Add a helper to check if a gendisk is associated with a request_queue.

Signed-off-by: Christoph Hellwig <hch at lst.de>
Reviewed-by: Jan Kara <jack at suse.cz>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn at wdc.com>
Link: https://lore.kernel.org/r/20210809141744.1203023-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe at kernel.dk>
(cherry picked from commit 1008162b2782a3624d12b0aee8da58bc75d12e19)
Signed-off-by: Koba Ko <koba.ko at canonical.com>
---
 include/linux/blkdev.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d95fee696627a..c7b6cdb64bcb7 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -672,6 +672,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)
-- 
2.25.1




More information about the kernel-team mailing list