Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Guixin Liu" <kanie@linux.alibaba.com>
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH 10/11] nvmet: translate placement identifiers of writes to write streams
Date: Mon, 19 Oct 2026 03:44:08 +0000	[thread overview]
Message-ID: <sashiko-outbox-176586@kernel.org> (raw)
In-Reply-To: <20261019033624.402337-11-kanie@linux.alibaba.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] nvmet: bi_write_stream lost on chained bios in nvmet_bdev_execute_rw()
--

commit ee4faa4396ddf960be1a3f58157a725fb3691c6f
Author: Guixin Liu <kanie@linux.alibaba.com>

nvmet: translate placement identifiers of writes to write streams

This commit translates NVMe Data Placement Directive placement identifiers
on write commands into block layer write streams on the backing block
device when FDP is enabled on the namespace.

> diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c
> index f2d9e8901df4e..ff480f9ab9906 100644
> --- a/drivers/nvme/target/io-cmd-bdev.c
> +++ b/drivers/nvme/target/io-cmd-bdev.c
> @@ -300,6 +300,10 @@ static void nvmet_bdev_execute_rw(struct nvmet_req *req)
>  	bio->bi_iter.bi_sector = sector;
>  	bio->bi_private = req;
>  	bio->bi_end_io = nvmet_bio_done;
> +	if (req->cmd->rw.opcode == nvme_cmd_write &&
> +	    nvmet_fdp_enabled(req->ns)) {
> +		bio->bi_write_stream = nvmet_fdp_write_stream(req);
> +	}
>  
>  	blk_start_plug(&plug);
>  	if (req->metadata_len)

[Severity: Medium]
What happens when a write command spans multiple bios in
nvmet_bdev_execute_rw()?

When req->sg_cnt exceeds BIO_MAX_VECS (or bio_add_page() otherwise fills
the current bio), the for_each_sg() loop allocates a new chained bio:

	for_each_sg(req->sg, sg, req->sg_cnt, i) {
		while (bio_add_page(bio, sg_page(sg), sg->length, sg->offset)
				!= sg->length) {
			struct bio *prev = bio;
			...
			bio = bio_alloc(req->ns->bdev, bio_max_segs(sg_cnt),
					opf, GFP_KERNEL);
			bio->bi_iter.bi_sector = sector;

			bio_chain(bio, prev);
			submit_bio(prev);
		}

Since bio_alloc() initializes bi_write_stream to 0 and bio_chain() does
not copy bi_write_stream from prev, won't all subsequent chained bios for
the write command be submitted with bi_write_stream set to 0 instead of
the stream returned by nvmet_fdp_write_stream(req), preventing them from
merging with the initial bio and routing the tail of the write to the
default stream instead of the host-selected reclaim unit?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261019033624.402337-1-kanie@linux.alibaba.com?part=10


  reply	other threads:[~2026-10-19  3:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19  3:36 [PATCH RESEND 0/11] nvmet: FDP bridge for NVMe-oF targets Guixin Liu
2026-10-19  3:36 ` [PATCH 01/11] nvme: add the FDP wire structures for the I/O management send command Guixin Liu
2026-10-19  3:36 ` [PATCH 02/11] block: add bdev_write_stream_granularity() Guixin Liu
2026-10-19  3:36 ` [PATCH 03/11] nvme: export nvme_bdev_ops Guixin Liu
2026-10-19  3:36 ` [PATCH 04/11] nvmet: add per-namespace FDP bridge state and configuration Guixin Liu
2026-10-19  3:36 ` [PATCH 05/11] nvmet: report the Endurance Group Identifier in the CS-INDEP identify data Guixin Liu
2026-10-19  3:36 ` [PATCH 06/11] nvmet: advertise the FDP capability Guixin Liu
2026-10-19  3:36 ` [PATCH 07/11] nvmet: implement the FDP feature Guixin Liu
2026-10-19  3:45   ` sashiko-bot
2026-10-19  8:30     ` Guixin Liu
2026-10-19  3:36 ` [PATCH 08/11] nvmet: forward the FDP I/O management commands to the backing device Guixin Liu
2026-10-19  3:57   ` sashiko-bot
2026-10-19  9:44     ` Guixin Liu
2026-10-19  3:36 ` [PATCH 09/11] nvmet: serve the FDP log pages Guixin Liu
2026-10-19  4:07   ` sashiko-bot
2026-10-19  3:36 ` [PATCH 10/11] nvmet: translate placement identifiers of writes to write streams Guixin Liu
2026-10-19  3:44   ` sashiko-bot [this message]
2026-10-19  8:27     ` Guixin Liu
2026-10-19  3:36 ` [PATCH 11/11] nvmet: add an FDP write translation tracepoint Guixin Liu
2026-10-19  3:48   ` sashiko-bot
2026-10-19  8:32     ` Guixin Liu
  -- strict thread matches above, loose matches on Subject: below --
2026-10-13  2:20 [PATCH 0/11] nvmet: FDP bridge for NVMe-oF targets Guixin Liu
2026-10-13  2:21 ` [PATCH 10/11] nvmet: translate placement identifiers of writes to write streams Guixin Liu

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=sashiko-outbox-176586@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kanie@linux.alibaba.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox