diff mbox series

blk-mq: remove the bio argument to ->prepare_request

Message ID 20200516154059.328211-1-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series blk-mq: remove the bio argument to ->prepare_request | expand

Commit Message

Christoph Hellwig May 16, 2020, 3:40 p.m. UTC
None of the I/O schedulers actually needs it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/bfq-iosched.c      | 2 +-
 block/blk-mq.c           | 2 +-
 block/kyber-iosched.c    | 2 +-
 block/mq-deadline.c      | 2 +-
 include/linux/elevator.h | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

Comments

Bart Van Assche May 16, 2020, 4:12 p.m. UTC | #1
On 2020-05-16 08:40, Christoph Hellwig wrote:
> None of the I/O schedulers actually needs it.

Is the next step perhaps to remove the bio argument from
blk_mq_get_request()? Anyway:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Christoph Hellwig May 16, 2020, 4:13 p.m. UTC | #2
On Sat, May 16, 2020 at 09:12:10AM -0700, Bart Van Assche wrote:
> On 2020-05-16 08:40, Christoph Hellwig wrote:
> > None of the I/O schedulers actually needs it.
> 
> Is the next step perhaps to remove the bio argument from
> blk_mq_get_request()? Anyway:

Yes, but that is a bigger surgery :)
Guoqing Jiang May 16, 2020, 4:36 p.m. UTC | #3
Hi Christoph,

On 5/16/20 6:13 PM, Christoph Hellwig wrote:
> On Sat, May 16, 2020 at 09:12:10AM -0700, Bart Van Assche wrote:
>> On 2020-05-16 08:40, Christoph Hellwig wrote:
>>> None of the I/O schedulers actually needs it.
>> Is the next step perhaps to remove the bio argument from
>> blk_mq_get_request()? Anyway:
> Yes, but that is a bigger surgery :)

I had local changes for it which was compiled test, and seems no new 
caller of blk_mq_get_request.

commit f888e1aa2cd2480ecc80bd67df5b5d3301408ac8
Author: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
Date:   Tue Mar 24 15:11:38 2020 +0100

     blk-mq: remove unused argument from blk_mq_get_request

     We can remove 'bio' from blk_mq_get_request as well since
     prepare_request doesn't need it anymore.

     Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 6a1725f7c319..a74c7710fc7d 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -332,7 +332,6 @@ static struct request *blk_mq_rq_ctx_init(struct 
blk_mq_alloc_data *data,
  }

  static struct request *blk_mq_get_request(struct request_queue *q,
-                                         struct bio *bio,
                                           struct blk_mq_alloc_data *data)
  {
         struct elevator_queue *e = q->elevator;
@@ -408,7 +407,7 @@ struct request *blk_mq_alloc_request(struct 
request_queue *q, unsigned int op,
         if (ret)
                 return ERR_PTR(ret);

-       rq = blk_mq_get_request(q, NULL, &alloc_data);
+       rq = blk_mq_get_request(q, &alloc_data);
         blk_queue_exit(q);

         if (!rq)
@@ -457,7 +456,7 @@ struct request *blk_mq_alloc_request_hctx(struct 
request_queue *q,
         cpu = cpumask_first_and(alloc_data.hctx->cpumask, cpu_online_mask);
         alloc_data.ctx = __blk_mq_get_ctx(q, cpu);

-       rq = blk_mq_get_request(q, NULL, &alloc_data);
+       rq = blk_mq_get_request(q, &alloc_data);
         blk_queue_exit(q);

         if (!rq)
@@ -1988,7 +1987,7 @@ static blk_qc_t blk_mq_make_request(struct 
request_queue *q, struct bio *bio)
         rq_qos_throttle(q, bio);

         data.cmd_flags = bio->bi_opf;
-       rq = blk_mq_get_request(q, bio, &data);
+       rq = blk_mq_get_request(q, &data);
         if (unlikely(!rq)) {
                 rq_qos_cleanup(q, bio);
                 if (bio->bi_opf & REQ_NOWAIT)

Thanks,
Guoqing
Christoph Hellwig May 16, 2020, 4:43 p.m. UTC | #4
On Sat, May 16, 2020 at 06:36:34PM +0200, Guoqing Jiang wrote:
> Hi Christoph,
>
> On 5/16/20 6:13 PM, Christoph Hellwig wrote:
>> On Sat, May 16, 2020 at 09:12:10AM -0700, Bart Van Assche wrote:
>>> On 2020-05-16 08:40, Christoph Hellwig wrote:
>>>> None of the I/O schedulers actually needs it.
>>> Is the next step perhaps to remove the bio argument from
>>> blk_mq_get_request()? Anyway:
>> Yes, but that is a bigger surgery :)
>
> I had local changes for it which was compiled test, and seems no new caller 
> of blk_mq_get_request.

Well, my plan was to sort out the calling conventions for real:

http://git.infradead.org/users/hch/block.git/commitdiff/bce839ff0799e398975c5a5c5a5123402ead6cc8
diff mbox series

Patch

diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 3d411716d7ee4..50c8f034c01c5 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -6073,7 +6073,7 @@  static struct bfq_queue *bfq_get_bfqq_handle_split(struct bfq_data *bfqd,
  * comments on bfq_init_rq for the reason behind this delayed
  * preparation.
  */
-static void bfq_prepare_request(struct request *rq, struct bio *bio)
+static void bfq_prepare_request(struct request *rq)
 {
 	/*
 	 * Regardless of whether we have an icq attached, we have to
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 6f0279a7b59aa..60adad51ad816 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -387,7 +387,7 @@  static struct request *blk_mq_get_request(struct request_queue *q,
 			if (e->type->icq_cache)
 				blk_mq_sched_assign_ioc(rq);
 
-			e->type->ops.prepare_request(rq, bio);
+			e->type->ops.prepare_request(rq);
 			rq->rq_flags |= RQF_ELVPRIV;
 		}
 	}
diff --git a/block/kyber-iosched.c b/block/kyber-iosched.c
index 34dcea0ef6377..a38c5ab103d12 100644
--- a/block/kyber-iosched.c
+++ b/block/kyber-iosched.c
@@ -579,7 +579,7 @@  static bool kyber_bio_merge(struct blk_mq_hw_ctx *hctx, struct bio *bio,
 	return merged;
 }
 
-static void kyber_prepare_request(struct request *rq, struct bio *bio)
+static void kyber_prepare_request(struct request *rq)
 {
 	rq_set_domain_token(rq, -1);
 }
diff --git a/block/mq-deadline.c b/block/mq-deadline.c
index b490f47fd553c..b57470e154c8f 100644
--- a/block/mq-deadline.c
+++ b/block/mq-deadline.c
@@ -541,7 +541,7 @@  static void dd_insert_requests(struct blk_mq_hw_ctx *hctx,
  * Nothing to do here. This is defined only to ensure that .finish_request
  * method is called upon request completion.
  */
-static void dd_prepare_request(struct request *rq, struct bio *bio)
+static void dd_prepare_request(struct request *rq)
 {
 }
 
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 901bda352dcb7..bacc40a0bdf39 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -39,7 +39,7 @@  struct elevator_mq_ops {
 	void (*request_merged)(struct request_queue *, struct request *, enum elv_merge);
 	void (*requests_merged)(struct request_queue *, struct request *, struct request *);
 	void (*limit_depth)(unsigned int, struct blk_mq_alloc_data *);
-	void (*prepare_request)(struct request *, struct bio *bio);
+	void (*prepare_request)(struct request *);
 	void (*finish_request)(struct request *);
 	void (*insert_requests)(struct blk_mq_hw_ctx *, struct list_head *, bool);
 	struct request *(*dispatch_request)(struct blk_mq_hw_ctx *);