[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1480706456-21111-1-git-send-email-fabf@skynet.be>
Date: Fri, 2 Dec 2016 20:20:56 +0100
From: Fabian Frederick <fabf@...net.be>
To: Dan Williams <dan.j.williams@...el.com>
Cc: linux-nvdimm@...ts.01.org, linux-kernel@...r.kernel.org,
fabf@...net.be
Subject: [PATCH 4/8 linux-next] libnvdimm, namespace: avoid multiple sector calculations
add cleared_sectors variable to add more readability.
Signed-off-by: Fabian Frederick <fabf@...net.be>
---
drivers/nvdimm/pmem.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 204912c..4da4735 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -52,16 +52,16 @@ static int pmem_clear_poison(struct pmem_device *pmem, phys_addr_t offset,
{
struct device *dev = to_dev(pmem);
sector_t sector;
- long cleared;
+ long cleared, cleared_sectors;
sector = (offset - pmem->data_offset) / 512;
cleared = nvdimm_clear_poison(dev, pmem->phys_addr + offset, len);
-
- if (cleared > 0 && cleared / 512) {
+ cleared_sectors = cleared / 512;
+ if (cleared > 0 && cleared_sectors) {
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);
+ __func__, (unsigned long long) sector,
+ cleared_sectors, cleared_sectors > 1 ? "s" : "");
+ badblocks_clear(&pmem->bb, sector, cleared_sectors);
} else {
return -EIO;
}
--
2.7.4
Powered by blists - more mailing lists