Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tokunori Ikegami <ikegami.t@gmail.com>
To: linux-nvme@lists.infradead.org
Cc: Tokunori Ikegami <ikegami.t@gmail.com>
Subject: [PATCH] nvme-sysfs: add 'lba_shift' ns attribute
Date: Sun, 22 Sep 2024 19:55:42 +0900	[thread overview]
Message-ID: <20240922105621.4642-1-ikegami.t@gmail.com> (raw)

This is to reduce the identify commands to get the information.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
---
 drivers/nvme/host/sysfs.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c
index 945b7fe11373..467049334f23 100644
--- a/drivers/nvme/host/sysfs.c
+++ b/drivers/nvme/host/sysfs.c
@@ -176,6 +176,13 @@ static ssize_t csi_show(struct device *dev, struct device_attribute *attr,
 }
 static DEVICE_ATTR_RO(csi);
 
+static ssize_t lba_shift_show(struct device *dev, struct device_attribute *attr,
+			      char *buf)
+{
+	return sysfs_emit(buf, "%u\n", dev_to_ns_head(dev)->lba_shift);
+}
+static DEVICE_ATTR_RO(lba_shift);
+
 static ssize_t metadata_bytes_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
@@ -259,6 +266,7 @@ static struct attribute *nvme_ns_attrs[] = {
 	&dev_attr_eui.attr,
 	&dev_attr_csi.attr,
 	&dev_attr_nsid.attr,
+	&dev_attr_lba_shift.attr,
 	&dev_attr_metadata_bytes.attr,
 	&dev_attr_nuse.attr,
 	&dev_attr_lbaf_index.attr,
-- 
2.43.0



             reply	other threads:[~2024-09-22 10:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-22 10:55 Tokunori Ikegami [this message]
2024-09-22 15:26 ` [PATCH] nvme-sysfs: add 'lba_shift' ns attribute Keith Busch
2024-09-22 18:39   ` Tokunori Ikegami

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=20240922105621.4642-1-ikegami.t@gmail.com \
    --to=ikegami.t@gmail.com \
    --cc=linux-nvme@lists.infradead.org \
    /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