linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Chaitanya Kulkarni <chaitanyak@nvidia.com>
Cc: Christoph Hellwig <hch@lst.de>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"kbusch@kernel.org" <kbusch@kernel.org>,
	"sagi@grimberg.me" <sagi@grimberg.me>
Subject: Re: [PATCH 0/3] nvmet: add buffered_io support for bdev-ns
Date: Thu, 27 Jan 2022 11:07:39 +0100	[thread overview]
Message-ID: <20220127100739.GA15004@lst.de> (raw)
In-Reply-To: <47264e99-cb1a-8eef-b49b-140b4de51150@nvidia.com>

On Thu, Jan 27, 2022 at 07:46:22AM +0000, Chaitanya Kulkarni wrote:
> This is exactly how I stared this patch-series, but above doesn't
> work since it errors out in the nvme_identify_ns() due to ncap value
> set to 0 (set from ns->size in id-ns admin on target side) see [1],
> since ns->size value we get is 0, that is set using call to
> vfs_getattr(STATX_SIZE) in the nvmet_file_ns_revalidate()
> for file backend.

Something like this should solve that issue:

diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c
index 6be6e59d273bb..fb7f4dd72daf6 100644
--- a/drivers/nvme/target/io-cmd-file.c
+++ b/drivers/nvme/target/io-cmd-file.c
@@ -16,14 +16,8 @@
 
 int nvmet_file_ns_revalidate(struct nvmet_ns *ns)
 {
-	struct kstat stat;
-	int ret;
-
-	ret = vfs_getattr(&ns->file->f_path, &stat, STATX_SIZE,
-			  AT_STATX_FORCE_SYNC);
-	if (!ret)
-		ns->size = stat.size;
-	return ret;
+	ns->size = i_size_read(ns->file->f_mapping->host);
+	return 0;
 }
 
 void nvmet_file_ns_disable(struct nvmet_ns *ns)


      parent reply	other threads:[~2022-01-27 10:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19  7:20 [PATCH 0/3] nvmet: add buffered_io support for bdev-ns Chaitanya Kulkarni
2022-01-19  7:20 ` [PATCH 1/3] nvmet: add helper to set ns->blkshift value Chaitanya Kulkarni
2022-01-23  9:18   ` Sagi Grimberg
2022-01-23 23:37     ` Chaitanya Kulkarni
2022-01-19  7:20 ` [PATCH 2/3] nvmet: add helper to open block device Chaitanya Kulkarni
2022-01-19  7:20 ` [PATCH 3/3] nvmet: allow bdev in buffered_io mode Chaitanya Kulkarni
2022-01-26 16:27 ` [PATCH 0/3] nvmet: add buffered_io support for bdev-ns Christoph Hellwig
2022-01-27  7:46   ` Chaitanya Kulkarni
2022-01-27  8:04     ` Chaitanya Kulkarni
2022-01-27 10:07       ` Christoph Hellwig
2022-01-27 10:07     ` Christoph Hellwig [this message]

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=20220127100739.GA15004@lst.de \
    --to=hch@lst.de \
    --cc=chaitanyak@nvidia.com \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).