linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* remove RQF_ELVPRIV
@ 2021-10-19 13:39 Christoph Hellwig
  2021-10-19 13:39 ` [PATCH 1/2] blk-mq: remove the RQF_ELVPRIV check in blk_mq_free_request Christoph Hellwig
  2021-10-19 13:39 ` [PATCH 2/2] blk-mq: remove RQF_ELVPRIV Christoph Hellwig
  0 siblings, 2 replies; 6+ messages in thread
From: Christoph Hellwig @ 2021-10-19 13:39 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block

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(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] blk-mq: remove the RQF_ELVPRIV check in blk_mq_free_request
  2021-10-19 13:39 remove RQF_ELVPRIV Christoph Hellwig
@ 2021-10-19 13:39 ` Christoph Hellwig
  2021-10-19 13:43   ` Jens Axboe
  2021-10-19 13:39 ` [PATCH 2/2] blk-mq: remove RQF_ELVPRIV Christoph Hellwig
  1 sibling, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2021-10-19 13:39 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block

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

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 428e0e0fd5504..34392c439d2a8 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -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)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] blk-mq: remove RQF_ELVPRIV
  2021-10-19 13:39 remove RQF_ELVPRIV Christoph Hellwig
  2021-10-19 13:39 ` [PATCH 1/2] blk-mq: remove the RQF_ELVPRIV check in blk_mq_free_request Christoph Hellwig
@ 2021-10-19 13:39 ` Christoph Hellwig
  1 sibling, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2021-10-19 13:39 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] blk-mq: remove the RQF_ELVPRIV check in blk_mq_free_request
  2021-10-19 13:39 ` [PATCH 1/2] blk-mq: remove the RQF_ELVPRIV check in blk_mq_free_request Christoph Hellwig
@ 2021-10-19 13:43   ` Jens Axboe
  2021-10-19 13:44     ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2021-10-19 13:43 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-block

On 10/19/21 7:39 AM, Christoph Hellwig wrote:
> If RQF_ELVPRIV is set RQF_ELV is by definition set as well.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  block/blk-mq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 428e0e0fd5504..34392c439d2a8 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -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.


-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] blk-mq: remove the RQF_ELVPRIV check in blk_mq_free_request
  2021-10-19 13:43   ` Jens Axboe
@ 2021-10-19 13:44     ` Christoph Hellwig
  2021-10-19 13:46       ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2021-10-19 13:44 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Christoph Hellwig, linux-block

On Tue, Oct 19, 2021 at 07:43:04AM -0600, Jens Axboe wrote:
> On 10/19/21 7:39 AM, Christoph Hellwig wrote:
> > If RQF_ELVPRIV is set RQF_ELV is by definition set as well.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> >  block/blk-mq.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/block/blk-mq.c b/block/blk-mq.c
> > index 428e0e0fd5504..34392c439d2a8 100644
> > --- a/block/blk-mq.c
> > +++ b/block/blk-mq.c
> > @@ -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.

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] blk-mq: remove the RQF_ELVPRIV check in blk_mq_free_request
  2021-10-19 13:44     ` Christoph Hellwig
@ 2021-10-19 13:46       ` Jens Axboe
  0 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2021-10-19 13:46 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-block

On 10/19/21 7:44 AM, Christoph Hellwig wrote:
> On Tue, Oct 19, 2021 at 07:43:04AM -0600, Jens Axboe wrote:
>> On 10/19/21 7:39 AM, Christoph Hellwig wrote:
>>> If RQF_ELVPRIV is set RQF_ELV is by definition set as well.
>>>
>>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>>> ---
>>>  block/blk-mq.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/block/blk-mq.c b/block/blk-mq.c
>>> index 428e0e0fd5504..34392c439d2a8 100644
>>> --- a/block/blk-mq.c
>>> +++ b/block/blk-mq.c
>>> @@ -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.
> 
> 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

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-10-19 13:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19 13:39 remove RQF_ELVPRIV Christoph Hellwig
2021-10-19 13:39 ` [PATCH 1/2] blk-mq: remove the RQF_ELVPRIV check in blk_mq_free_request Christoph Hellwig
2021-10-19 13:43   ` Jens Axboe
2021-10-19 13:44     ` Christoph Hellwig
2021-10-19 13:46       ` Jens Axboe
2021-10-19 13:39 ` [PATCH 2/2] blk-mq: remove RQF_ELVPRIV Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).