summaryrefslogtreecommitdiff
path: root/include/linux/blkdev.h
diff options
context:
space:
mode:
authorMike Christie <mchristi@redhat.com>2016-06-05 14:31:42 -0500
committerJens Axboe <axboe@fb.com>2016-06-07 13:41:38 -0600
commitf21508211d2b16e65821abd171378fa6ece126fe (patch)
tree4b85b32a065cf6c28ccd2ad1a2960ec6f4b67634 /include/linux/blkdev.h
parent4e49ea4a3d276365bf7396c9b77b4d1d5923835a (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.h10
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 {
struct request *next_rq;
};
+#define req_op(req) (op_from_rq_bits((req)->cmd_flags))
+#define req_set_op(req, op) ((req)->cmd_flags |= op)
+#define req_set_op_attrs(req, op, flags) do { \
+ req_set_op(req, op); \
+ (req)->cmd_flags |= flags; \
+} while (0)
+
static inline unsigned short req_get_ioprio(struct request *req)
{
return req->ioprio;
@@ -597,7 +604,8 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist)
-#define rq_data_dir(rq) ((int)((rq)->cmd_flags & 1))
+#define rq_data_dir(rq) \
+ (op_is_write(op_from_rq_bits(rq->cmd_flags)) ? WRITE : READ)
/*
* Driver can handle struct request, if it either has an old style