block: move rq_list macros to blk-mq.h
authorKeith Busch <kbusch@kernel.org>
Wed, 5 Jan 2022 17:05:15 +0000 (09:05 -0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 5 Jan 2022 19:25:42 +0000 (12:25 -0700)
Move the request list macros to the header file that defines that struct
they operate on.

Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220105170518.3181469-2-kbusch@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c
include/linux/blk-mq.h
include/linux/blkdev.h

index c4f2176..42bbbd3 100644 (file)
@@ -57,7 +57,7 @@
 #include <linux/mman.h>
 #include <linux/percpu.h>
 #include <linux/slab.h>
-#include <linux/blkdev.h>
+#include <linux/blk-mq.h>
 #include <linux/bvec.h>
 #include <linux/net.h>
 #include <net/sock.h>
index 550996c..bf64b94 100644 (file)
@@ -216,6 +216,35 @@ static inline unsigned short req_get_ioprio(struct request *req)
 #define rq_dma_dir(rq) \
        (op_is_write(req_op(rq)) ? DMA_TO_DEVICE : DMA_FROM_DEVICE)
 
+#define rq_list_add(listptr, rq)       do {            \
+       (rq)->rq_next = *(listptr);                     \
+       *(listptr) = rq;                                \
+} while (0)
+
+#define rq_list_pop(listptr)                           \
+({                                                     \
+       struct request *__req = NULL;                   \
+       if ((listptr) && *(listptr))    {               \
+               __req = *(listptr);                     \
+               *(listptr) = __req->rq_next;            \
+       }                                               \
+       __req;                                          \
+})
+
+#define rq_list_peek(listptr)                          \
+({                                                     \
+       struct request *__req = NULL;                   \
+       if ((listptr) && *(listptr))                    \
+               __req = *(listptr);                     \
+       __req;                                          \
+})
+
+#define rq_list_for_each(listptr, pos)                 \
+       for (pos = rq_list_peek((listptr)); pos; pos = rq_list_next(pos))
+
+#define rq_list_next(rq)       (rq)->rq_next
+#define rq_list_empty(list)    ((list) == (struct request *) NULL)
+
 enum blk_eh_timer_return {
        BLK_EH_DONE,            /* drivers has completed the command */
        BLK_EH_RESET_TIMER,     /* reset timer and try again */
index 22746b2..9c95df2 100644 (file)
@@ -1339,33 +1339,4 @@ struct io_comp_batch {
 
 #define DEFINE_IO_COMP_BATCH(name)     struct io_comp_batch name = { }
 
-#define rq_list_add(listptr, rq)       do {            \
-       (rq)->rq_next = *(listptr);                     \
-       *(listptr) = rq;                                \
-} while (0)
-
-#define rq_list_pop(listptr)                           \
-({                                                     \
-       struct request *__req = NULL;                   \
-       if ((listptr) && *(listptr))    {               \
-               __req = *(listptr);                     \
-               *(listptr) = __req->rq_next;            \
-       }                                               \
-       __req;                                          \
-})
-
-#define rq_list_peek(listptr)                          \
-({                                                     \
-       struct request *__req = NULL;                   \
-       if ((listptr) && *(listptr))                    \
-               __req = *(listptr);                     \
-       __req;                                          \
-})
-
-#define rq_list_for_each(listptr, pos)                 \
-       for (pos = rq_list_peek((listptr)); pos; pos = rq_list_next(pos))
-
-#define rq_list_next(rq)       (rq)->rq_next
-#define rq_list_empty(list)    ((list) == (struct request *) NULL)
-
 #endif /* _LINUX_BLKDEV_H */