[PATCH] nvme-sysfs: add 'lba_shift' ns attribute
Tokunori Ikegami
ikegami.t at gmail.com
Sun Sep 22 03:55:42 PDT 2024
This is to reduce the identify commands to get the information.
Signed-off-by: Tokunori Ikegami <ikegami.t at 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
More information about the Linux-nvme
mailing list