[PATCH 3/5] block: add a queue_has_disk helper

From
Christoph Hellwig <hidden>
Date
2021-08-09 14:21:09
Also in
linux-block, linux-fsdevel, linux-mm
Reply to
Christoph Hellwig, 2021-08-09
Add a helper to check if a gendisk is associated with a request_queue.

Signed-off-by: Christoph Hellwig <redacted>
---
 include/linux/blkdev.h | 1 +
 1 file changed, 1 insertion(+)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index ac3642c88a4d..96f3d9617cd8 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -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)
-- 
2.30.2
Thread (31 messages) 31 messages, 7 authors, last reply 2021-10-14
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help