Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5] nvmet: report ns's vwc not present
@ 2024-11-13 10:18 Guixin Liu
  2024-11-13 14:31 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Guixin Liu @ 2024-11-13 10:18 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	Chaitanya Kulkarni
  Cc: linux-nvme

Currently, we report that controller has vwc even though the ns may
not have vwc. Report ns's vwc not present when not buffered_io or
backdev doesn't have vwc.

Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
Based on Keith's v4 patch,
Changes from v4 to v5:
- When the backend is file, report support vwc even though buffered_io is
  disable, and add an annotation to expain it.

 drivers/nvme/target/admin-cmd.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 0a9fdc533186..934b401fbc2f 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -934,6 +934,13 @@ static void nvmet_execute_id_cs_indep(struct nvmet_req *req)
 		id->nsattr |= NVME_NS_ATTR_RO;
 	if (req->ns->bdev && !bdev_nonrot(req->ns->bdev))
 		id->nsfeat |= NVME_NS_ROTATIONAL;
+	/*
+	 * We need flush command to flush the file's metadata,
+	 * so report supporting vwc if backend is file, even
+	 * though buffered_io is disable.
+	 */
+	if (req->ns->bdev && !bdev_write_cache(req->ns->bdev))
+		id->nsfeat |= NVME_NS_VWC_NOT_PRESENT;
 
 	status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id));
 	kfree(id);
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v5] nvmet: report ns's vwc not present
  2024-11-13 10:18 [PATCH v5] nvmet: report ns's vwc not present Guixin Liu
@ 2024-11-13 14:31 ` Christoph Hellwig
  2024-11-13 16:35 ` Chaitanya Kulkarni
  2024-11-13 16:58 ` Keith Busch
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2024-11-13 14:31 UTC (permalink / raw)
  To: Guixin Liu
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	Chaitanya Kulkarni, linux-nvme

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v5] nvmet: report ns's vwc not present
  2024-11-13 10:18 [PATCH v5] nvmet: report ns's vwc not present Guixin Liu
  2024-11-13 14:31 ` Christoph Hellwig
@ 2024-11-13 16:35 ` Chaitanya Kulkarni
  2024-11-13 16:58 ` Keith Busch
  2 siblings, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2024-11-13 16:35 UTC (permalink / raw)
  To: Guixin Liu, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, Chaitanya Kulkarni
  Cc: linux-nvme@lists.infradead.org

On 11/13/24 02:18, Guixin Liu wrote:
> Currently, we report that controller has vwc even though the ns may
> not have vwc. Report ns's vwc not present when not buffered_io or
> backdev doesn't have vwc.
>
> Signed-off-by: Guixin Liu<kanie@linux.alibaba.com>
> Signed-off-by: Keith Busch<kbusch@kernel.org>
> ---

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v5] nvmet: report ns's vwc not present
  2024-11-13 10:18 [PATCH v5] nvmet: report ns's vwc not present Guixin Liu
  2024-11-13 14:31 ` Christoph Hellwig
  2024-11-13 16:35 ` Chaitanya Kulkarni
@ 2024-11-13 16:58 ` Keith Busch
  2 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2024-11-13 16:58 UTC (permalink / raw)
  To: Guixin Liu
  Cc: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni,
	linux-nvme

On Wed, Nov 13, 2024 at 06:18:39PM +0800, Guixin Liu wrote:
> Currently, we report that controller has vwc even though the ns may
> not have vwc. Report ns's vwc not present when not buffered_io or
> backdev doesn't have vwc.

Thanks, applied to nvme-6.13.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-13 16:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-13 10:18 [PATCH v5] nvmet: report ns's vwc not present Guixin Liu
2024-11-13 14:31 ` Christoph Hellwig
2024-11-13 16:35 ` Chaitanya Kulkarni
2024-11-13 16:58 ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox