Move the request list macros to the header file that defines that struct they operate on.
Unified · Split
| @@ -57,7 +57,7 @@ · 56 unmodified lines | |||
| 57 | #include <linux/mman.h> | 57 | #include <linux/mman.h> |
| 58 | #include <linux/percpu.h> | 58 | #include <linux/percpu.h> |
| 59 | #include <linux/slab.h> | 59 | #include <linux/slab.h> |
| 60 | #include <linux/blkdev.h> | 60 | #include <linux/blk-mq.h> |
| 61 | #include <linux/bvec.h> | 61 | #include <linux/bvec.h> |
| 62 | #include <linux/net.h> | 62 | #include <linux/net.h> |
| 63 | #include <net/sock.h> | 63 | #include <net/sock.h> |
| @@ -216,6 +216,35 @@ static inline unsigned short req_get_ioprio(struct request *req) · 215 unmodified lines | |||
| 216 | #define rq_dma_dir(rq) \ | 216 | #define rq_dma_dir(rq) \ |
| 217 | (op_is_write(req_op(rq)) ? DMA_TO_DEVICE : DMA_FROM_DEVICE) | 217 | (op_is_write(req_op(rq)) ? DMA_TO_DEVICE : DMA_FROM_DEVICE) |
| 218 | 218 | ||
| 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 | |||
| 219 | enum blk_eh_timer_return { | 248 | enum blk_eh_timer_return { |
| 220 | BLK_EH_DONE, /* drivers has completed the command */ | 249 | BLK_EH_DONE, /* drivers has completed the command */ |
| 221 | BLK_EH_RESET_TIMER, /* reset timer and try again */ | 250 | BLK_EH_RESET_TIMER, /* reset timer and try again */ |
| @@ -1339,33 +1339,4 @@ struct io_comp_batch { · 1338 unmodified lines | |||
| 1339 | 1339 | ||
| 1340 | #define DEFINE_IO_COMP_BATCH(name) struct io_comp_batch name = { } | 1340 | #define DEFINE_IO_COMP_BATCH(name) struct io_comp_batch name = { } |
| 1341 | 1341 | ||
| 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 | |||
| 1371 | #endif /* _LINUX_BLKDEV_H */ | 1342 | #endif /* _LINUX_BLKDEV_H */ |