]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: fix lbaf inuse to use 6:5 bits
authorSteven Seungcheol Lee <sc108.lee@samsung.com>
Mon, 8 Jul 2024 06:55:54 +0000 (15:55 +0900)
committerDaniel Wagner <wagi@monom.org>
Tue, 9 Jul 2024 10:23:59 +0000 (12:23 +0200)
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
nvme.c

diff --git a/nvme.c b/nvme.c
index 70798a58f73e7d55364bc2503e99c6a966b27f3e..d998c80083b7c2f0689f34d4c9c1708c0027e1bc 100644 (file)
--- 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'!",