summaryrefslogtreecommitdiffstats
path: root/include/linux/blkdev.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-10-20 09:12:13 -0400
committerJens Axboe <axboe@fb.com>2016-10-28 10:45:17 -0400
commite806402130c9c494e22c73ae9ead4e79d2a5811c (patch)
treebac59e1eb3f1b5945409bd0780a4824e9b8383f8 /include/linux/blkdev.h
parent8d2bbd4c8236e9e38e6b36ac9e2c54fdcfe5b335 (diff)
block: split out request-only flags into a new namespace
A lot of the REQ_* flags are only used on struct requests, and only of use to the block layer and a few drivers that dig into struct request internals. This patch adds a new req_flags_t rq_flags field to struct request for them, and thus dramatically shrinks the number of common requests. It also removes the unfortunate situation where we have to fit the fields from the same enum into 32 bits for struct bio and 64 bits for struct request. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Shaun Tancheff <shaun.tancheff@seagate.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r--include/linux/blkdev.h49
1 files changed, 48 insertions, 1 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 90097dd8b8ed..b4415feac679 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -78,6 +78,50 @@ enum rq_cmd_type_bits {
78 REQ_TYPE_DRV_PRIV, /* driver defined types from here */ 78 REQ_TYPE_DRV_PRIV, /* driver defined types from here */
79}; 79};
80 80
81/*
82 * request flags */
83typedef __u32 __bitwise req_flags_t;
84
85/* elevator knows about this request */
86#define RQF_SORTED ((__force req_flags_t)(1 << 0))
87/* drive already may have started this one */
88#define RQF_STARTED ((__force req_flags_t)(1 << 1))
89/* uses tagged queueing */
90#define RQF_QUEUED ((__force req_flags_t)(1 << 2))
91/* may not be passed by ioscheduler */
92#define RQF_SOFTBARRIER ((__force req_flags_t)(1 << 3))
93/* request for flush sequence */
94#define RQF_FLUSH_SEQ ((__force req_flags_t)(1 << 4))
95/* merge of different types, fail separately */
96#define RQF_MIXED_MERGE ((__force req_flags_t)(1 << 5))
97/* track inflight for MQ */
98#define RQF_MQ_INFLIGHT ((__force req_flags_t)(1 << 6))
99/* don't call prep for this one */
100#define RQF_DONTPREP ((__force req_flags_t)(1 << 7))
101/* set for "ide_preempt" requests and also for requests for which the SCSI
102 "quiesce" state must be ignored. */
103#define RQF_PREEMPT ((__force req_flags_t)(1 << 8))
104/* contains copies of user pages */
105#define RQF_COPY_USER ((__force req_flags_t)(1 << 9))
106/* vaguely specified driver internal error. Ignored by the block layer */
107#define RQF_FAILED ((__force req_flags_t)(1 << 10))
108/* don't warn about errors */
109#define RQF_QUIET ((__force req_flags_t)(1 << 11))
110/* elevator private data attached */
111#define RQF_ELVPRIV ((__force req_flags_t)(1 << 12))
112/* account I/O stat */
113#define RQF_IO_STAT ((__force req_flags_t)(1 << 13))
114/* request came from our alloc pool */
115#define RQF_ALLOCED ((__force req_flags_t)(1 << 14))
116/* runtime pm request */
117#define RQF_PM ((__force req_flags_t)(1 << 15))
118/* on IO scheduler merge hash */
119#define RQF_HASHED ((__force req_flags_t)(1 << 16))
120
121/* flags that prevent us from merging requests: */
122#define RQF_NOMERGE_FLAGS \
123 (RQF_STARTED | RQF_SOFTBARRIER | RQF_FLUSH_SEQ)
124
81#define BLK_MAX_CDB 16 125#define BLK_MAX_CDB 16
82 126
83/* 127/*
@@ -99,6 +143,7 @@ struct request {
99 int cpu; 143 int cpu;
100 unsigned cmd_type; 144 unsigned cmd_type;
101 u64 cmd_flags; 145 u64 cmd_flags;
146 req_flags_t rq_flags;
102 unsigned long atomic_flags; 147 unsigned long atomic_flags;
103 148
104 /* the following two fields are internal, NEVER access directly */ 149 /* the following two fields are internal, NEVER access directly */
@@ -648,7 +693,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
648 REQ_FAILFAST_DRIVER)) 693 REQ_FAILFAST_DRIVER))
649 694
650#define blk_account_rq(rq) \ 695#define blk_account_rq(rq) \
651 (((rq)->cmd_flags & REQ_STARTED) && \ 696 (((rq)->rq_flags & RQF_STARTED) && \
652 ((rq)->cmd_type == REQ_TYPE_FS)) 697 ((rq)->cmd_type == REQ_TYPE_FS))
653 698
654#define blk_rq_cpu_valid(rq) ((rq)->cpu != -1) 699#define blk_rq_cpu_valid(rq) ((rq)->cpu != -1)
@@ -740,6 +785,8 @@ static inline bool rq_mergeable(struct request *rq)
740 785
741 if (rq->cmd_flags & REQ_NOMERGE_FLAGS) 786 if (rq->cmd_flags & REQ_NOMERGE_FLAGS)
742 return false; 787 return false;
788 if (rq->rq_flags & RQF_NOMERGE_FLAGS)
789 return false;
743 790
744 return true; 791 return true;
745} 792}