Skip to contentSkip to conversation

nvme-sysfs: add 'lba_shift' ns attribute

PATCH In review Tokunori Ikegami 2 participants 3 messages Sep 22, 2024 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-sysfs: add 'lba_shift' ns attribute

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

---
 drivers/nvme/host/sysfs.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/nvme/host/sysfs.c +8 -0
index 945b7fe11373..467049334f23 100644
@@ -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,
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 1 line · Tokunori Ikegami

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

This proposed attribute is redundant with the request_queue's already exported "logical_block_size" attribute.

#2 lore raw

Okay will do consider to use the attribute mentioned. Thank you.

Quoted 4 lines · Keith Busch
Quoted 1 line · Tokunori Ikegami

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

This proposed attribute is redundant with the request_queue's already exported "logical_block_size" attribute.