Skip to contentSkip to conversation

remove RQF_ELVPRIV

PATCH In review Christoph Hellwig 2 participants 6 messages Oct 19, 2021 Block layer

lore
Share & tools
lore
#0 lore raw

Hi Jens,

this series removes the RQF_ELVPRIV flag which isn't really needed anymore.

Diffstat;

 block/blk-mq-debugfs.c |    1 -
 block/blk-mq-sched.h   |    5 ++---
 block/blk-mq.c         |    3 +--
 include/linux/blk-mq.h |    2 --
 4 files changed, 3 insertions(+), 8 deletions(-)
#1 lore raw

PATCH 1/2 blk-mq: remove the RQF_ELVPRIV check in blk_mq_free_request

If RQF_ELVPRIV is set RQF_ELV is by definition set as well.

---
 block/blk-mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +1 -1
index 428e0e0fd5504..34392c439d2a8 100644
@@ -580,7 +580,7 @@ void blk_mq_free_request(struct request *rq)
 	struct request_queue *q = rq->q;
 	struct blk_mq_hw_ctx *hctx = rq->mq_hctx;
 
-	if (rq->rq_flags & (RQF_ELVPRIV | RQF_ELV)) {
+	if (rq->rq_flags & RQF_ELV) {
 		struct elevator_queue *e = q->elevator;
 
 		if (e->type->ops.finish_request)
Signature · 1 line
2.30.2
maintainer
#2 lore raw

Re: [PATCH 1/2] blk-mq: remove the RQF_ELVPRIV check in blk_mq_free_request

Quoted 12 lines · Christoph Hellwig

If RQF_ELVPRIV is set RQF_ELV is by definition set as well.

---
 block/blk-mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +0 -0
index 428e0e0fd5504..34392c439d2a8 100644

block/blk-mq.c void blk_mq_free_request(struct request *rq) · line 583

Quoted 5 lines
block/blk-mq.c +1 -1
@@ -580,7 +580,7 @@ void blk_mq_free_request(struct request *rq)
 	struct request_queue *q = rq->q;
 	struct blk_mq_hw_ctx *hctx = rq->mq_hctx;
 
-	if (rq->rq_flags & (RQF_ELVPRIV | RQF_ELV)) {
+	if (rq->rq_flags & RQF_ELV) {

Actually just fixed a bug there. RQF_ELV means "we have an IO scheduler", and RQF_ELVPRIV means that plus "we have rq private data". The above shouldn't check RQF_ELV at all, just PRIV.

Signature · 1 line
Jens Axboe
#3 lore raw

Re: [PATCH 1/2] blk-mq: remove the RQF_ELVPRIV check in blk_mq_free_request

Quoted 16 lines · Jens Axboe
Quoted 15 lines · Christoph Hellwig

If RQF_ELVPRIV is set RQF_ELV is by definition set as well.

---
 block/blk-mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +0 -0
index 428e0e0fd5504..34392c439d2a8 100644
@@ -580,7 +580,7 @@ void blk_mq_free_request(struct request *rq)
 	struct request_queue *q = rq->q;
 	struct blk_mq_hw_ctx *hctx = rq->mq_hctx;
 
Quoted 6 lines

block/blk-mq.c void blk_mq_free_request(struct request *rq) · line 583

Quoted 2 lines
block/blk-mq.c +1 -1
-	if (rq->rq_flags & (RQF_ELVPRIV | RQF_ELV)) {
+	if (rq->rq_flags & RQF_ELV) {

Actually just fixed a bug there. RQF_ELV means "we have an IO scheduler", and RQF_ELVPRIV means that plus "we have rq private data". The above shouldn't check RQF_ELV at all, just PRIV.

Well, in that case RQF_ELVPRIV can be replaced with
RQF_ELV && !op_is_flush as in the next patch. But I can resend once I see the fix in a tree somewhere.

maintainer
#4 lore raw

Re: [PATCH 1/2] blk-mq: remove the RQF_ELVPRIV check in blk_mq_free_request

Quoted 24 lines · Christoph Hellwig
Quoted 16 lines · Jens Axboe
Quoted 15 lines · Christoph Hellwig

If RQF_ELVPRIV is set RQF_ELV is by definition set as well.

---
 block/blk-mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +0 -0
index 428e0e0fd5504..34392c439d2a8 100644
@@ -580,7 +580,7 @@ void blk_mq_free_request(struct request *rq)
 	struct request_queue *q = rq->q;
 	struct blk_mq_hw_ctx *hctx = rq->mq_hctx;
 
Quoted 6 lines

block/blk-mq.c void blk_mq_free_request(struct request *rq) · line 583

Quoted 2 lines
block/blk-mq.c +1 -1
-	if (rq->rq_flags & (RQF_ELVPRIV | RQF_ELV)) {
+	if (rq->rq_flags & RQF_ELV) {

Actually just fixed a bug there. RQF_ELV means "we have an IO scheduler", and RQF_ELVPRIV means that plus "we have rq private data". The above shouldn't check RQF_ELV at all, just PRIV.

Quoted 3 lines

Well, in that case RQF_ELVPRIV can be replaced with
RQF_ELV && !op_is_flush as in the next patch. But I can resend once I see the fix in a tree somewhere.

That'd be great. It's in for-5.16/block

Signature · 1 line
Jens Axboe
#5 lore raw

PATCH 2/2 blk-mq: remove RQF_ELVPRIV

In reply to Christoph Hellwig

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.

---
 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(-)
block/blk-mq-debugfs.c +0 -1
index a317f05de466a..efd48992bda09 100644
@@ -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),
block/blk-mq-sched.h +2 -3
index 98836106b25fc..6de63222c16d1 100644
@@ -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);
 	}
 }
block/blk-mq.c +0 -1
index 34392c439d2a8..d2dad19d5b85c 100644
@@ -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;
 		}
 	}
 
include/linux/blk-mq.h +0 -2
index 649be3f21d740..ad810e1be8f29 100644
@@ -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))
Signature · 1 line
2.30.2