]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
Fix to determine initial value for lba in print_list_item
authorstevegalbraith <steven.galbraith@pmcs.com>
Wed, 27 May 2015 16:36:38 +0000 (09:36 -0700)
committerstevegalbraith <steven.galbraith@pmcs.com>
Wed, 27 May 2015 16:36:38 +0000 (09:36 -0700)
The index used to determine lba value takes into accout the entire FLBAS field.  Bit 4 determines whether an extended or separate is used to send metadata and if set to 1'b,
throws off the index value.  Masked out the top 4 bits to only take into account Bits 3:0 which indicate the LBA format type used.

nvme.c

diff --git a/nvme.c b/nvme.c
index c4bb36957883041aab108653ca28d033daa556a1..599c5484601d5f27f7fef81ac0667d4aada31cc7 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -1259,7 +1259,7 @@ static void print_list_item(struct list_item list_item)
 
        double nsze       = list_item.ns.nsze;
        double nuse       = list_item.ns.nuse;
-       long long int lba = list_item.ns.lbaf[list_item.ns.flbas].ds;
+       long long int lba = list_item.ns.lbaf[(list_item.ns.flbas & 0x0f)].ds;
 
        lba  = (1 << lba);
        nsze *= lba;