All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Max Gurtovoy <maxg@mellanox.com>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
	Keith Busch <keith.busch@intel.com>,
	Sagi Grimberg <sagi@grimberg.me>, Hannes Reinecke <hare@suse.de>,
	Johannes Thumshirn <jthumshirn@suse.de>,
	linux-nvme@lists.infradead.org, linux-block@vger.kernel.org
Subject: Re: [PATCH 04/17] block: add a blk_steal_bios helper
Date: Sat, 28 Oct 2017 08:13:42 +0200	[thread overview]
Message-ID: <20171028061342.GA13723@lst.de> (raw)
In-Reply-To: <ac15137b-b1a4-3988-17cc-fd6c25749542@mellanox.com>

On Tue, Oct 24, 2017 at 11:44:26AM +0300, Max Gurtovoy wrote:
>> + * Steal bios from a request.  The request must not have been partially
>> + * completed before.
>> + */
>
> Maybe we can add to the comment that "list" is the destination for the 
> stolen bio.

Sure.

>> +void blk_steal_bios(struct bio_list *list, struct request *rq)
>> +{
>> +	if (rq->bio) {
>> +		if (list->tail)
>> +			list->tail->bi_next = rq->bio;
>> +		else
>> +			list->head = rq->bio;
>> +		list->tail = rq->biotail;
>
> if list->tail != NULL don't we lose the "list->tail->bi_next = rq->bio;" 
> assignment after assigning "list->tail = rq->biotail;" ?

the biolists are a little weird, they are a single linked list of bi_next
plus a tail pointer.

So if the list is emptry (->tail == NULL) we assign the biolist
to ->head and point ->tail to end of the list in the request.

But if the list is not empty we let ->bi_next of the last entry
(as found in ->tail) point to the list we splice on, and still update
->tail to end of the list we spliced on.  So I think this looks all ok.

>> +	}
>> +
>> +	rq->bio = NULL;
>
> we can add this NULL assignment inside the big "if", but I'm not sure 
> regarding the next 2 assignments.
> Anyway not a big deal.

We can move both the ->bio and ->biotail assignments, and I've done it.

WARNING: multiple messages have this Message-ID (diff)
From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH 04/17] block: add a blk_steal_bios helper
Date: Sat, 28 Oct 2017 08:13:42 +0200	[thread overview]
Message-ID: <20171028061342.GA13723@lst.de> (raw)
In-Reply-To: <ac15137b-b1a4-3988-17cc-fd6c25749542@mellanox.com>

On Tue, Oct 24, 2017@11:44:26AM +0300, Max Gurtovoy wrote:
>> + * Steal bios from a request.  The request must not have been partially
>> + * completed before.
>> + */
>
> Maybe we can add to the comment that "list" is the destination for the 
> stolen bio.

Sure.

>> +void blk_steal_bios(struct bio_list *list, struct request *rq)
>> +{
>> +	if (rq->bio) {
>> +		if (list->tail)
>> +			list->tail->bi_next = rq->bio;
>> +		else
>> +			list->head = rq->bio;
>> +		list->tail = rq->biotail;
>
> if list->tail != NULL don't we lose the "list->tail->bi_next = rq->bio;" 
> assignment after assigning "list->tail = rq->biotail;" ?

the biolists are a little weird, they are a single linked list of bi_next
plus a tail pointer.

So if the list is emptry (->tail == NULL) we assign the biolist
to ->head and point ->tail to end of the list in the request.

But if the list is not empty we let ->bi_next of the last entry
(as found in ->tail) point to the list we splice on, and still update
->tail to end of the list we spliced on.  So I think this looks all ok.

>> +	}
>> +
>> +	rq->bio = NULL;
>
> we can add this NULL assignment inside the big "if", but I'm not sure 
> regarding the next 2 assignments.
> Anyway not a big deal.

We can move both the ->bio and ->biotail assignments, and I've done it.

  reply	other threads:[~2017-10-28  6:13 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-23 14:51 nvme multipath support V5 Christoph Hellwig
2017-10-23 14:51 ` Christoph Hellwig
2017-10-23 14:51 ` [PATCH 01/17] block: move REQ_NOWAIT Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-23 14:51 ` [PATCH 02/17] block: add REQ_DRV bit Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-23 14:51 ` [PATCH 03/17] block: provide a direct_make_request helper Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-24  7:05   ` Hannes Reinecke
2017-10-24  7:05     ` Hannes Reinecke
2017-10-24 17:57   ` Javier González
2017-10-24 17:57     ` Javier González
2017-10-23 14:51 ` [PATCH 04/17] block: add a blk_steal_bios helper Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-24  7:07   ` Hannes Reinecke
2017-10-24  7:07     ` Hannes Reinecke
2017-10-24  8:44   ` Max Gurtovoy
2017-10-24  8:44     ` Max Gurtovoy
2017-10-28  6:13     ` Christoph Hellwig [this message]
2017-10-28  6:13       ` Christoph Hellwig
2017-10-23 14:51 ` [PATCH 05/17] block: don't look at the struct device dev_t in disk_devt Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-24  7:08   ` Hannes Reinecke
2017-10-24  7:08     ` Hannes Reinecke
2017-10-23 14:51 ` [PATCH 06/17] block: introduce GENHD_FL_HIDDEN Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-24  7:18   ` Hannes Reinecke
2017-10-24  7:18     ` Hannes Reinecke
2017-10-28  6:15     ` Christoph Hellwig
2017-10-28  6:15       ` Christoph Hellwig
2017-10-24 21:40   ` Mike Snitzer
2017-10-24 21:40     ` Mike Snitzer
2017-10-28  6:38     ` Christoph Hellwig
2017-10-28  6:38       ` Christoph Hellwig
2017-10-28  7:20       ` Guan Junxiong
2017-10-28  7:20         ` Guan Junxiong
2017-10-28  7:42         ` Christoph Hellwig
2017-10-28  7:42           ` Christoph Hellwig
2017-10-28 10:09           ` Guan Junxiong
2017-10-28 10:09             ` Guan Junxiong
2017-10-29  8:00             ` Anish Jhaveri
2017-10-29  8:00               ` Anish Jhaveri
2017-10-29  8:57             ` Christoph Hellwig
2017-10-29  8:57               ` Christoph Hellwig
2017-10-28 14:17       ` Mike Snitzer
2017-10-28 14:17         ` Mike Snitzer
2017-10-29 10:01         ` Hannes Reinecke
2017-10-29 10:01           ` Hannes Reinecke
2017-10-30  4:09           ` Guan Junxiong
2017-10-30  4:09             ` Guan Junxiong
2017-10-23 14:51 ` [PATCH 07/17] block: add a poll_fn callback to struct request_queue Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-24  7:20   ` Hannes Reinecke
2017-10-24  7:20     ` Hannes Reinecke
2017-10-23 14:51 ` [PATCH 08/17] nvme: use kref_get_unless_zero in nvme_find_get_ns Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-24  7:21   ` Hannes Reinecke
2017-10-24  7:21     ` Hannes Reinecke
2017-10-23 14:51 ` [PATCH 09/17] nvme: simplify nvme_open Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-24  7:21   ` Hannes Reinecke
2017-10-24  7:21     ` Hannes Reinecke
2017-10-23 14:51 ` [PATCH 10/17] nvme: switch controller refcounting to use struct device Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-24  7:23   ` Hannes Reinecke
2017-10-24  7:23     ` Hannes Reinecke
2017-10-23 14:51 ` [PATCH 11/17] nvme: get rid of nvme_ctrl_list Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-24  7:24   ` Hannes Reinecke
2017-10-24  7:24     ` Hannes Reinecke
2017-10-23 14:51 ` [PATCH 12/17] nvme: check for a live controller in nvme_dev_open Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-24  7:25   ` Hannes Reinecke
2017-10-24  7:25     ` Hannes Reinecke
2017-10-23 14:51 ` [PATCH 13/17] nvme: track subsystems Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-24  7:33   ` Hannes Reinecke
2017-10-24  7:33     ` Hannes Reinecke
2017-10-23 14:51 ` [PATCH 14/17] nvme: introduce a nvme_ns_ids structure Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-24  7:27   ` Hannes Reinecke
2017-10-24  7:27     ` Hannes Reinecke
2017-10-23 14:51 ` [PATCH 15/17] nvme: track shared namespaces Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-24  7:34   ` Hannes Reinecke
2017-10-24  7:34     ` Hannes Reinecke
2017-10-23 14:51 ` [PATCH 16/17] nvme: implement multipath access to nvme subsystems Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-23 15:32   ` Sagi Grimberg
2017-10-23 15:32     ` Sagi Grimberg
2017-10-23 16:57     ` Christoph Hellwig
2017-10-23 16:57       ` Christoph Hellwig
2017-10-23 17:43   ` Sagi Grimberg
2017-10-23 17:43     ` Sagi Grimberg
2017-10-24  7:43   ` Hannes Reinecke
2017-10-24  7:43     ` Hannes Reinecke
2017-10-28  6:32     ` Christoph Hellwig
2017-10-28  6:32       ` Christoph Hellwig
2017-10-30  3:37   ` Guan Junxiong
2017-10-30  3:37     ` Guan Junxiong
2017-11-02 18:22     ` Christoph Hellwig
2017-11-02 18:22       ` Christoph Hellwig
2017-10-23 14:51 ` [PATCH 17/17] nvme: also expose the namespace identification sysfs files for mpath nodes Christoph Hellwig
2017-10-23 14:51   ` Christoph Hellwig
2017-10-24  7:45   ` Hannes Reinecke
2017-10-24  7:45     ` Hannes Reinecke
2017-10-28  6:20     ` Christoph Hellwig
2017-10-28  6:20       ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2017-10-18 16:52 nvme multipath support V4 Christoph Hellwig
2017-10-18 16:52 ` [PATCH 04/17] block: add a blk_steal_bios helper Christoph Hellwig
2017-10-18 16:52   ` Christoph Hellwig

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=20171028061342.GA13723@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=hare@suse.de \
    --cc=jthumshirn@suse.de \
    --cc=keith.busch@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=maxg@mellanox.com \
    --cc=sagi@grimberg.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.