Commit 0a3f27b9 authored by Fabian Frederick's avatar Fabian Frederick Committed by Dan Williams

libnvdimm, namespace: avoid multiple sector calculations

Use sector_t for cleared
Suggested-by: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent d37806dc
......@@ -51,17 +51,16 @@ static void pmem_clear_poison(struct pmem_device *pmem, phys_addr_t offset,
unsigned int len)
{
struct device *dev = to_dev(pmem);
sector_t sector;
long cleared;
sector_t sector, cleared;
sector = (offset - pmem->data_offset) / 512;
cleared = nvdimm_clear_poison(dev, pmem->phys_addr + offset, len);
cleared = nvdimm_clear_poison(dev, pmem->phys_addr + offset, len) / 512;
if (cleared > 0 && cleared / 512) {
if (cleared) {
dev_dbg(dev, "%s: %#llx clear %ld sector%s\n",
__func__, (unsigned long long) sector,
cleared / 512, cleared / 512 > 1 ? "s" : "");
badblocks_clear(&pmem->bb, sector, cleared / 512);
cleared, cleared > 1 ? "s" : "");
badblocks_clear(&pmem->bb, sector, cleared);
}
invalidate_pmem(pmem->virt_addr + offset, len);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment