History

block: move rq_list macros to blk-mq.h

Move the request list macros to the header file that defines that struct they operate on.

Keith Busch committed 4 years ago

Commit edce22e1 parent 669a0643 files · +30 −30Browse files

Unified · Split

3 files
  1. fs/io_uring.c +1 −1
  2. include/linux/blk-mq.h +29 −0
  3. include/linux/blkdev.h +0 −29
fs/io_uring.c+1−1
@@ -57,7 +57,7 @@ · 56 unmodified lines
5757 #include <linux/mman.h>
5858 #include <linux/percpu.h>
5959 #include <linux/slab.h>
60−#include <linux/blkdev.h>
60+#include <linux/blk-mq.h>
6161 #include <linux/bvec.h>
6262 #include <linux/net.h>
6363 #include <net/sock.h>
include/linux/blk-mq.h+29−0
@@ -216,6 +216,35 @@ static inline unsigned short req_get_ioprio(struct request *req) · 215 unmodified lines
216216 #define rq_dma_dir(rq) \
217217 (op_is_write(req_op(rq)) ? DMA_TO_DEVICE : DMA_FROM_DEVICE)
218218
219+#define rq_list_add(listptr, rq) do { \
220+ (rq)->rq_next = *(listptr); \
221+ *(listptr) = rq; \
222+} while (0)
223+
224+#define rq_list_pop(listptr) \
225+({ \
226+ struct request *__req = NULL; \
227+ if ((listptr) && *(listptr)) { \
228+ __req = *(listptr); \
229+ *(listptr) = __req->rq_next; \
230+ } \
231+ __req; \
232+})
233+
234+#define rq_list_peek(listptr) \
235+({ \
236+ struct request *__req = NULL; \
237+ if ((listptr) && *(listptr)) \
238+ __req = *(listptr); \
239+ __req; \
240+})
241+
242+#define rq_list_for_each(listptr, pos) \
243+ for (pos = rq_list_peek((listptr)); pos; pos = rq_list_next(pos))
244+
245+#define rq_list_next(rq) (rq)->rq_next
246+#define rq_list_empty(list) ((list) == (struct request *) NULL)
247+
219248 enum blk_eh_timer_return {
220249 BLK_EH_DONE, /* drivers has completed the command */
221250 BLK_EH_RESET_TIMER, /* reset timer and try again */
include/linux/blkdev.h+0−29
@@ -1339,33 +1339,4 @@ struct io_comp_batch { · 1338 unmodified lines
13391339
13401340 #define DEFINE_IO_COMP_BATCH(name) struct io_comp_batch name = { }
13411341
1342−#define rq_list_add(listptr, rq) do { \
1343− (rq)->rq_next = *(listptr); \
1344− *(listptr) = rq; \
1345−} while (0)
1346−
1347−#define rq_list_pop(listptr) \
1348−({ \
1349− struct request *__req = NULL; \
1350− if ((listptr) && *(listptr)) { \
1351− __req = *(listptr); \
1352− *(listptr) = __req->rq_next; \
1353− } \
1354− __req; \
1355−})
1356−
1357−#define rq_list_peek(listptr) \
1358−({ \
1359− struct request *__req = NULL; \
1360− if ((listptr) && *(listptr)) \
1361− __req = *(listptr); \
1362− __req; \
1363−})
1364−
1365−#define rq_list_for_each(listptr, pos) \
1366− for (pos = rq_list_peek((listptr)); pos; pos = rq_list_next(pos))
1367−
1368−#define rq_list_next(rq) (rq)->rq_next
1369−#define rq_list_empty(list) ((list) == (struct request *) NULL)
1370−
13711342 #endif /* _LINUX_BLKDEV_H */