From ef8ca2bedc8ebaec2d1a974f15d8443d06b616ff Mon Sep 17 00:00:00 2001 From: Steven Seungcheol Lee Date: Mon, 8 Jul 2024 15:55:54 +0900 Subject: [PATCH] nvme: fix lbaf inuse to use 6:5 bits Signed-off-by: Steven Seungcheol Lee --- nvme.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nvme.c b/nvme.c index 70798a58..d998c800 100644 --- a/nvme.c +++ b/nvme.c @@ -2901,10 +2901,10 @@ static int parse_lba_num_si(struct nvme_dev *dev, const char *opt, _cleanup_free_ struct nvme_id_ctrl *ctrl = NULL; _cleanup_free_ struct nvme_id_ns *ns = NULL; __u32 nsid = 1; + __u8 lbaf; unsigned int remainder; char *endptr; int err = -EINVAL; - int i; int lbas; struct nvme_identify_args args = { @@ -2970,8 +2970,8 @@ static int parse_lba_num_si(struct nvme_dev *dev, const char *opt, return err; } - i = flbas & NVME_NS_FLBAS_LOWER_MASK; - lbas = (1 << ns->lbaf[i].ds) + ns->lbaf[i].ms; + nvme_id_ns_flbas_to_lbaf_inuse(flbas, &lbaf); + lbas = (1 << ns->lbaf[lbaf].ds) + ns->lbaf[lbaf].ms; if (suffix_si_parse(val, &endptr, (uint64_t *)num)) { nvme_show_error("Expected long suffixed integer argument for '%s-si' but got '%s'!", -- 2.50.1