From: stevegalbraith Date: Wed, 27 May 2015 16:36:38 +0000 (-0700) Subject: Fix to determine initial value for lba in print_list_item X-Git-Tag: v0.1~40^2^2~1^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e5c4ea7131c1a12732e6982b45b4d68e7b75f34e;p=users%2Fsagi%2Fnvme-cli.git Fix to determine initial value for lba in print_list_item 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. --- diff --git a/nvme.c b/nvme.c index c4bb3695..599c5484 100644 --- 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;