diff options
| author | Mike Christie <mchristi@redhat.com> | 2016-06-05 15:31:42 -0400 |
|---|---|---|
| committer | Jens Axboe <axboe@fb.com> | 2016-06-07 15:41:38 -0400 |
| commit | f21508211d2b16e65821abd171378fa6ece126fe (patch) | |
| tree | 4b85b32a065cf6c28ccd2ad1a2960ec6f4b67634 /include/linux/blkdev.h | |
| parent | 4e49ea4a3d276365bf7396c9b77b4d1d5923835a (diff) | |
block: add REQ_OP definitions and helpers
The following patches separate the operation (WRITE, READ, DISCARD,
etc) from the rq_flag_bits flags. This patch adds definitions for
request/bio operations (REQ_OPs) and adds request/bio accessors to
get/set the op.
In this patch the REQ_OPs match the REQ rq_flag_bits ones
for compat reasons while all the code is converted to use the
op accessors in the set. In the last patches the op will become a
number and the accessors and helpers in this patch will be dropped
or updated.
Signed-off-by: Mike Christie <mchristi@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/linux/blkdev.h')
| -rw-r--r-- | include/linux/blkdev.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 3d9cf326574f..49c2dbcad583 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -200,6 +200,13 @@ struct request { | |||
| 200 | struct request *next_rq; | 200 | struct request *next_rq; |
| 201 | }; | 201 | }; |
| 202 | 202 | ||
| 203 | #define req_op(req) (op_from_rq_bits((req)->cmd_flags)) | ||
| 204 | #define req_set_op(req, op) ((req)->cmd_flags |= op) | ||
| 205 | #define req_set_op_attrs(req, op, flags) do { \ | ||
| 206 | req_set_op(req, op); \ | ||
| 207 | (req)->cmd_flags |= flags; \ | ||
| 208 | } while (0) | ||
| 209 | |||
| 203 | static inline unsigned short req_get_ioprio(struct request *req) | 210 | static inline unsigned short req_get_ioprio(struct request *req) |
| 204 | { | 211 | { |
| 205 | return req->ioprio; | 212 | return req->ioprio; |
| @@ -597,7 +604,8 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) | |||
| 597 | 604 | ||
| 598 | #define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) | 605 | #define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) |
| 599 | 606 | ||
| 600 | #define rq_data_dir(rq) ((int)((rq)->cmd_flags & 1)) | 607 | #define rq_data_dir(rq) \ |
| 608 | (op_is_write(op_from_rq_bits(rq->cmd_flags)) ? WRITE : READ) | ||
| 601 | 609 | ||
| 602 | /* | 610 | /* |
| 603 | * Driver can handle struct request, if it either has an old style | 611 | * Driver can handle struct request, if it either has an old style |
