History

lightnvm: invalid offset calculation for lba_shift

The ns->lba_shift assumes its value to be the logarithmic of the LA size. A previous patch duplicated the lba_shift calculation into lightnvm. It prematurely also subtracted a 512byte shift, which commonly is applied per-command. The 512byte shift being subtracted twice led to data loss when restoring the logical to physical mapping table from device and when issuing I/O commands using rrpc. Fix offset by removing the 512byte shift subtraction when calculating lba_shift.

Matias Bjørling committed 10 years ago

Commit 409ae5a1 parent 86e4ee71 file · +1 −1Browse files

Unified · Split

drivers/nvme/host/lightnvm.c+1−1
@@ -612,7 +612,7 @@ int nvme_nvm_register(struct nvme_ns *ns, char *disk_name, int node, · 611 unmodified lines
612 612
613 ret = nvm_register(dev);613 ret = nvm_register(dev);
614 614
615 ns->lba_shift = ilog2(dev->sec_size) - 9;615 ns->lba_shift = ilog2(dev->sec_size);
616 616
617 if (sysfs_create_group(&dev->dev.kobj, attrs))617 if (sysfs_create_group(&dev->dev.kobj, attrs))
618 pr_warn("%s: failed to create sysfs group for identification\n",618 pr_warn("%s: failed to create sysfs group for identification\n",