All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Manzanares <Adam.Manzanares@wdc.com>
To: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	Damien Le Moal <Damien.LeMoal@wdc.com>,
	"axboe@kernel.dk" <axboe@kernel.dk>
Cc: "viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 2/7] block: Remove bio->bi_ioc
Date: Mon, 19 Nov 2018 19:07:18 +0000	[thread overview]
Message-ID: <cd28e72b1a597f1915948e280fe3e2468e44f524.camel@wdc.com> (raw)
In-Reply-To: <20181119035131.11255-3-damien.lemoal@wdc.com>

On Mon, 2018-11-19 at 12:51 +0900, Damien Le Moal wrote:
> bio->bi_ioc is never set so always NULL. Remove references to it in
> bio_disassociate_task() and in rq_ioc() and delete this field from
> struct bio. With this change, rq_ioc() always returns
> current->io_context without the need for a bio argument. Further
> simplify the code and make it more readable by also removing this
> helper, which also allows to simplify blk_mq_sched_assign_ioc() by
> removing its bio argument.
> 
> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>

Looks good,

Reviewed-by: Adam Manzanares <adam.manzanares@wdc.com>


Reviewed by: 
> ---
>  block/bio.c               |  4 ----
>  block/blk-core.c          |  2 +-
>  block/blk-mq-sched.c      |  4 ++--
>  block/blk-mq-sched.h      |  2 +-
>  block/blk-mq.c            |  4 ++--
>  block/blk.h               | 16 ----------------
>  include/linux/blk_types.h |  3 +--
>  7 files changed, 7 insertions(+), 28 deletions(-)
> 
> diff --git a/block/bio.c b/block/bio.c
> index 4f4d9884443b..03895cc0d74a 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -2027,10 +2027,6 @@ int bio_associate_blkg(struct bio *bio, struct
> blkcg_gq *blkg)
>   */
>  void bio_disassociate_task(struct bio *bio)
>  {
> -	if (bio->bi_ioc) {
> -		put_io_context(bio->bi_ioc);
> -		bio->bi_ioc = NULL;
> -	}
>  	if (bio->bi_css) {
>  		css_put(bio->bi_css);
>  		bio->bi_css = NULL;
> diff --git a/block/blk-core.c b/block/blk-core.c
> index d6e8ab9ca99d..492648c96992 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -813,7 +813,7 @@ unsigned int blk_plug_queued_count(struct
> request_queue *q)
>  
>  void blk_init_request_from_bio(struct request *req, struct bio *bio)
>  {
> -	struct io_context *ioc = rq_ioc(bio);
> +	struct io_context *ioc = current->io_context;
>  
>  	if (bio->bi_opf & REQ_RAHEAD)
>  		req->cmd_flags |= REQ_FAILFAST_MASK;
> diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
> index d084f731d104..13b8dc332541 100644
> --- a/block/blk-mq-sched.c
> +++ b/block/blk-mq-sched.c
> @@ -31,10 +31,10 @@ void blk_mq_sched_free_hctx_data(struct
> request_queue *q,
>  }
>  EXPORT_SYMBOL_GPL(blk_mq_sched_free_hctx_data);
>  
> -void blk_mq_sched_assign_ioc(struct request *rq, struct bio *bio)
> +void blk_mq_sched_assign_ioc(struct request *rq)
>  {
>  	struct request_queue *q = rq->q;
> -	struct io_context *ioc = rq_ioc(bio);
> +	struct io_context *ioc = current->io_context;
>  	struct io_cq *icq;
>  
>  	spin_lock_irq(&q->queue_lock);
> diff --git a/block/blk-mq-sched.h b/block/blk-mq-sched.h
> index 7ff5671bf128..0f719c8532ae 100644
> --- a/block/blk-mq-sched.h
> +++ b/block/blk-mq-sched.h
> @@ -8,7 +8,7 @@
>  void blk_mq_sched_free_hctx_data(struct request_queue *q,
>  				 void (*exit)(struct blk_mq_hw_ctx *));
>  
> -void blk_mq_sched_assign_ioc(struct request *rq, struct bio *bio);
> +void blk_mq_sched_assign_ioc(struct request *rq);
>  
>  void blk_mq_sched_request_inserted(struct request *rq);
>  bool blk_mq_sched_try_merge(struct request_queue *q, struct bio
> *bio,
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 32b246ed44c0..636f80b96fa6 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -389,8 +389,8 @@ static struct request *blk_mq_get_request(struct
> request_queue *q,
>  	if (!op_is_flush(data->cmd_flags)) {
>  		rq->elv.icq = NULL;
>  		if (e && e->type->ops.prepare_request) {
> -			if (e->type->icq_cache && rq_ioc(bio))
> -				blk_mq_sched_assign_ioc(rq, bio);
> +			if (e->type->icq_cache)
> +				blk_mq_sched_assign_ioc(rq);
>  
>  			e->type->ops.prepare_request(rq, bio);
>  			rq->rq_flags |= RQF_ELVPRIV;
> diff --git a/block/blk.h b/block/blk.h
> index 816a9abb87cd..610948157a5b 100644
> --- a/block/blk.h
> +++ b/block/blk.h
> @@ -254,22 +254,6 @@ void ioc_clear_queue(struct request_queue *q);
>  
>  int create_task_io_context(struct task_struct *task, gfp_t gfp_mask,
> int node);
>  
> -/**
> - * rq_ioc - determine io_context for request allocation
> - * @bio: request being allocated is for this bio (can be %NULL)
> - *
> - * Determine io_context to use for request allocation for @bio.  May
> return
> - * %NULL if %current->io_context doesn't exist.
> - */
> -static inline struct io_context *rq_ioc(struct bio *bio)
> -{
> -#ifdef CONFIG_BLK_CGROUP
> -	if (bio && bio->bi_ioc)
> -		return bio->bi_ioc;
> -#endif
> -	return current->io_context;
> -}
> -
>  /**
>   * create_io_context - try to create task->io_context
>   * @gfp_mask: allocation mask
> diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
> index dbdbfbd6a987..c0ba1a038ff3 100644
> --- a/include/linux/blk_types.h
> +++ b/include/linux/blk_types.h
> @@ -174,10 +174,9 @@ struct bio {
>  	void			*bi_private;
>  #ifdef CONFIG_BLK_CGROUP
>  	/*
> -	 * Optional ioc and css associated with this bio.  Put on bio
> +	 * Optional css associated with this bio.  Put on bio
>  	 * release.  Read comment on top of bio_associate_current().
>  	 */
> -	struct io_context	*bi_ioc;
>  	struct cgroup_subsys_state *bi_css;
>  	struct blkcg_gq		*bi_blkg;
>  	struct bio_issue	bi_issue;

  parent reply	other threads:[~2018-11-19 19:07 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-19  3:51 [PATCH 0/7] Improve I/O priority handling Damien Le Moal
2018-11-19  3:51 ` [PATCH 1/7] aio: Comment use of IOCB_FLAG_IOPRIO aio flag Damien Le Moal
2018-11-19  8:12   ` Christoph Hellwig
2018-11-19  8:15   ` Johannes Thumshirn
2018-11-19  3:51 ` [PATCH 2/7] block: Remove bio->bi_ioc Damien Le Moal
2018-11-19  8:13   ` Christoph Hellwig
2018-11-19  8:16   ` Johannes Thumshirn
2018-11-19 19:07   ` Adam Manzanares [this message]
2018-11-20 17:21   ` Ming Lei
2018-11-20 17:31     ` Jens Axboe
2018-11-20 23:58       ` Damien Le Moal
2018-11-21  1:24         ` Ming Lei
2018-11-21  1:31           ` Damien Le Moal
2018-11-21  2:10         ` Jens Axboe
2018-11-21  2:14           ` Damien Le Moal
2018-11-21  2:45           ` Damien Le Moal
2018-11-21  2:48             ` Jens Axboe
2018-11-21  2:50               ` Damien Le Moal
2018-11-21  1:21       ` Ming Lei
2018-11-19  3:51 ` [PATCH 3/7] block: Fix get_task_ioprio() default return value Damien Le Moal
2018-11-19  8:16   ` Christoph Hellwig
2018-11-20  1:47     ` Damien Le Moal
2018-11-19  3:51 ` [PATCH 4/7] block: Introduce get_current_ioprio() Damien Le Moal
2018-11-19  8:17   ` Christoph Hellwig
2018-11-19  8:26   ` Johannes Thumshirn
2018-11-19 18:17   ` Adam Manzanares
2018-11-19 23:46     ` Damien Le Moal
2018-11-19  3:51 ` [PATCH 5/7] aio: Fix fallback I/O priority value Damien Le Moal
2018-11-19  8:18   ` Christoph Hellwig
2018-11-19  8:27   ` Johannes Thumshirn
2018-11-19 19:08   ` Adam Manzanares
2018-11-19  3:51 ` [PATCH 6/7] block: prevent merging of requests with different priorities Damien Le Moal
2018-11-19  8:19   ` Christoph Hellwig
2018-11-19  8:31   ` Johannes Thumshirn
2018-11-19  3:51 ` [PATCH 7/7] block: Initialize BIO I/O priority early Damien Le Moal
2018-11-19  8:19   ` Christoph Hellwig
2018-11-19 19:11   ` Adam Manzanares

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd28e72b1a597f1915948e280fe3e2468e44f524.camel@wdc.com \
    --to=adam.manzanares@wdc.com \
    --cc=Damien.LeMoal@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.