All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <tom.leiming@gmail.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, Matias Bjorling <m@bjorling.me>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux SCSI List <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH 5/7] blk-mq: initialize request on allocation
Date: Thu, 17 Apr 2014 22:54:23 +0800	[thread overview]
Message-ID: <CACVXFVMAq0qw5vXqShmhcTTA5nww_OYaVz-yiEaf3_Q3-nrJfQ@mail.gmail.com> (raw)
In-Reply-To: <1397464212-4454-6-git-send-email-hch@lst.de>

On Mon, Apr 14, 2014 at 4:30 PM, Christoph Hellwig <hch@lst.de> wrote:
> If we want to share tag and request allocation between queues we cannot
> initialize the request at init/free time, but need to initialize it
> at allocation time as it might get used for different queues over its
> lifetime.

Could you explain the use pattern? Looks you mean there are
still users of the tag/req even after it is freed, that looks a bit
weird since the tag/req can still be reallocated in another path
after it is freed.

>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  block/blk-mq.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index ef7acc0..1cb7618 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -82,6 +82,7 @@ static struct request *__blk_mq_alloc_request(struct blk_mq_hw_ctx *hctx,
>         tag = blk_mq_get_tag(hctx->tags, gfp, reserved);
>         if (tag != BLK_MQ_TAG_FAIL) {
>                 rq = hctx->rqs[tag];
> +               blk_rq_init(hctx->queue, rq);
>                 rq->tag = tag;
>
>                 return rq;
> @@ -254,9 +255,7 @@ static void __blk_mq_free_request(struct blk_mq_hw_ctx *hctx,
>         const int tag = rq->tag;
>         struct request_queue *q = rq->q;
>
> -       blk_rq_init(hctx->queue, rq);
>         blk_mq_put_tag(hctx->tags, tag);
> -
>         blk_mq_queue_exit(q);
>  }
>
> @@ -1100,7 +1099,6 @@ static int blk_mq_init_rq_map(struct blk_mq_hw_ctx *hctx,
>                 left -= to_do * rq_size;
>                 for (j = 0; j < to_do; j++) {
>                         hctx->rqs[i] = p;
> -                       blk_rq_init(hctx->queue, hctx->rqs[i]);
>                         if (reg->ops->init_request) {
>                                 error = reg->ops->init_request(driver_data,
>                                                 hctx, hctx->rqs[i], i);
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


Thanks,
-- 
Ming Lei

  reply	other threads:[~2014-04-17 14:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <blk-mq updates>
2014-04-14  8:30 ` Christoph Hellwig
2014-04-14  8:30   ` [PATCH 1/7] blk-mq: initialize resid_len Christoph Hellwig
2014-04-14  8:30   ` [PATCH 2/7] blk-mq: do not initialize req->special Christoph Hellwig
2014-04-14  8:30   ` [PATCH 3/7] blk-mq: make ->flush_rq fully transparent to drivers Christoph Hellwig
2014-04-14  8:30   ` [PATCH 4/7] blk-mq: add ->init_request and ->exit_request methods Christoph Hellwig
2014-04-14  8:30   ` [PATCH 5/7] blk-mq: initialize request on allocation Christoph Hellwig
2014-04-17 14:54     ` Ming Lei [this message]
2014-04-17 14:57       ` Christoph Hellwig
2014-04-17 15:07         ` Ming Lei
2014-04-14  8:30   ` [PATCH 6/7] blk-mq: split out tag initialization, support shared tags Christoph Hellwig
2014-04-14  8:30   ` [PATCH 7/7] block: all blk-mq requests are tagged Christoph Hellwig
2014-04-15 20:16   ` Jens Axboe

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=CACVXFVMAq0qw5vXqShmhcTTA5nww_OYaVz-yiEaf3_Q3-nrJfQ@mail.gmail.com \
    --to=tom.leiming@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=m@bjorling.me \
    /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.