Skip to contentSkip to conversation

NVMe: Report device's preferred IO unit

PATCH New Keith Busch 1 participant 1 message Sep 30, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NVMe: Report device's preferred IO unit

This sets the queue's io_opt, which is the device's smallest preferred request size and alignment for sustained performance. The nvme namespace's logical block format with the relative performance set to 0 is optimal for the device.

Signed-off-by Keith Busch <keith.busch at intel.com>
---
 drivers/block/nvme-core.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/block/nvme-core.c +8 -0
index 9aeef40..73e01d5 100644
@@ -2031,6 +2031,14 @@ static struct nvme_ns *nvme_alloc_ns(struct nvme_dev *dev, unsigned nsid,
 	if (dev->vwc & NVME_CTRL_VWC_PRESENT)
 		blk_queue_flush(ns->queue, REQ_FLUSH | REQ_FUA);
 
+	for (lbaf = 0; lbaf < id->nlbaf; lbaf++) {
+		u16 rp = le16_to_cpu(id->lbaf[lbaf].rp);
+		if (!rp) {
+			blk_queue_io_opt(ns->queue, 1 << id->lbaf[lbaf].ds);
+			break;
+		}
+	}
+
 	disk->major = nvme_major;
 	disk->first_minor = 0;
 	disk->fops = &nvme_fops;
Signature · 1 line
1.7.10.4