diff options
author | Klaus Jensen <k.jensen@samsung.com> | 2021-04-13 21:51:30 +0200 |
---|---|---|
committer | Klaus Jensen <k.jensen@samsung.com> | 2021-05-17 09:18:59 +0200 |
commit | 3ef73f9462a0c142dce80ce5b4ff8789b39f2f64 (patch) | |
tree | 5d5f01cdee96e0ae53ad89fab9e77222eeda7639 /hw/block/nvme.h | |
parent | 6146f3dd35cd71b4ac594b2e4a86c4bb3af52b09 (diff) |
hw/block/nvme: add metadata offset helper
Add an nvme_moff() helper.
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'hw/block/nvme.h')
-rw-r--r-- | hw/block/nvme.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/hw/block/nvme.h b/hw/block/nvme.h index dc065e57b5..9349d1c33a 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -107,7 +107,7 @@ typedef struct NvmeNamespace { BlockConf blkconf; int32_t bootindex; int64_t size; - int64_t mdata_offset; + int64_t moff; NvmeIdNs id_ns; NvmeLBAF lbaf; size_t lbasz; @@ -158,6 +158,11 @@ static inline size_t nvme_m2b(NvmeNamespace *ns, uint64_t lba) return ns->lbaf.ms * lba; } +static inline int64_t nvme_moff(NvmeNamespace *ns, uint64_t lba) +{ + return ns->moff + nvme_m2b(ns, lba); +} + static inline bool nvme_ns_ext(NvmeNamespace *ns) { return !!NVME_ID_NS_FLBAS_EXTENDED(ns->id_ns.flbas); |