[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 01/14] hw/block/nvme: Report actual LBA data shift in LBAF
From: |
Dmitry Fomichev |
Subject: |
[PATCH v5 01/14] hw/block/nvme: Report actual LBA data shift in LBAF |
Date: |
Mon, 28 Sep 2020 11:35:15 +0900 |
Calculate the data shift value to report based on the set value of
logical_block_size device property.
In the process, use a local variable to calculate the LBA format
index instead of the hardcoded value 0. This makes the code more
readable and it will make it easier to add support for multiple LBA
formats in the future.
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
---
hw/block/nvme-ns.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c
index 2ba0263dda..bbd7879492 100644
--- a/hw/block/nvme-ns.c
+++ b/hw/block/nvme-ns.c
@@ -47,6 +47,8 @@ static void nvme_ns_init(NvmeNamespace *ns)
static int nvme_ns_init_blk(NvmeCtrl *n, NvmeNamespace *ns, Error **errp)
{
+ int lba_index;
+
if (!blkconf_blocksizes(&ns->blkconf, errp)) {
return -1;
}
@@ -67,6 +69,9 @@ static int nvme_ns_init_blk(NvmeCtrl *n, NvmeNamespace *ns,
Error **errp)
n->features.vwc = 0x1;
}
+ lba_index = NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas);
+ ns->id_ns.lbaf[lba_index].ds = 31 - clz32(n->conf.logical_block_size);
+
return 0;
}
--
2.21.0
- [PATCH v5 00/14] hw/block/nvme: Support Namespace Types and Zoned Namespace Command Set, Dmitry Fomichev, 2020/09/27
- [PATCH v5 01/14] hw/block/nvme: Report actual LBA data shift in LBAF,
Dmitry Fomichev <=
- [PATCH v5 04/14] hw/block/nvme: Define trace events related to NS Types, Dmitry Fomichev, 2020/09/27
- [PATCH v5 02/14] hw/block/nvme: Add Commands Supported and Effects log, Dmitry Fomichev, 2020/09/27
- [PATCH v5 03/14] hw/block/nvme: Introduce the Namespace Types definitions, Dmitry Fomichev, 2020/09/27
- [PATCH v5 05/14] hw/block/nvme: Add support for Namespace Types, Dmitry Fomichev, 2020/09/27
- [PATCH v5 06/14] hw/block/nvme: Add support for active/inactive namespaces, Dmitry Fomichev, 2020/09/27