[PATCH 2/2] blk-mq: remove RQF_ELVPRIV

Christoph Hellwig
2021-10-19T13:39:55Z

RQF_ELVPRIV is set for all non-flush requests that have an I/O scheduler
with a prepare_request method, and it is checked in a single place where
we already know that the request was initialized and has an I/O
scheduler. Given that there is no I/O scheduler that has a
requeue_request method but not prepare_request method there is no need
for this extra flag.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/blk-mq-debugfs.c | 1 -
block/blk-mq-sched.h | 5 ++---
block/blk-mq.c | 1 -
include/linux/blk-mq.h | 2 --
4 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index a317f05de466a..efd48992bda09 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -300,7 +300,6 @@ static const char *const rqf_name[] = {
RQF_NAME(DONTPREP),
RQF_NAME(FAILED),
RQF_NAME(QUIET),
- RQF_NAME(ELVPRIV),
RQF_NAME(IO_STAT),
RQF_NAME(PM),
RQF_NAME(HASHED),
diff --git a/block/blk-mq-sched.h b/block/blk-mq-sched.h
index 98836106b25fc..6de63222c16d1 100644
--- a/block/blk-mq-sched.h
+++ b/block/blk-mq-sched.h
@@ -78,10 +78,9 @@ static inline void blk_mq_sched_completed_request(struct request *rq, u64 now)
static inline void blk_mq_sched_requeue_request(struct request *rq)
{
if (rq->rq_flags & RQF_ELV) {
- struct request_queue *q = rq->q;
- struct elevator_queue *e = q->elevator;
+ struct elevator_queue *e = rq->q->elevator;

- if ((rq->rq_flags & RQF_ELVPRIV) && e->type->ops.requeue_request)
+ if (!op_is_flush(rq->cmd_flags) && e->type->ops.requeue_request)
e->type->ops.requeue_request(rq);
}
}
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 34392c439d2a8..d2dad19d5b85c 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -369,7 +369,6 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
blk_mq_sched_assign_ioc(rq);

e->type->ops.prepare_request(rq);
- rq->rq_flags |= RQF_ELVPRIV;
}
}

diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 649be3f21d740..ad810e1be8f29 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -37,8 +37,6 @@ typedef __u32 __bitwise req_flags_t;
/* don't warn about errors */
#define RQF_QUIET ((__force req_flags_t)(1 << 11))
/* elevator private data attached */
-#define RQF_ELVPRIV ((__force req_flags_t)(1 << 12))
-/* account into disk and partition IO statistics */
#define RQF_IO_STAT ((__force req_flags_t)(1 << 13))
/* runtime pm request */
#define RQF_PM ((__force req_flags_t)(1 << 15))
--
2.30.2