All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabian Frederick <fabf@skynet.be>
To: Dan Williams <dan.j.williams@intel.com>
Cc: fabf@skynet.be, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org
Subject: [PATCH 4/8 linux-next] libnvdimm, namespace: avoid multiple sector calculations
Date: Fri,  2 Dec 2016 20:20:56 +0100	[thread overview]
Message-ID: <1480706456-21111-1-git-send-email-fabf@skynet.be> (raw)

add cleared_sectors variable to add more readability.

Signed-off-by: Fabian Frederick <fabf@skynet.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

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

WARNING: multiple messages have this Message-ID (diff)
From: Fabian Frederick <fabf@skynet.be>
To: Dan Williams <dan.j.williams@intel.com>
Cc: linux-nvdimm@ml01.01.org, linux-kernel@vger.kernel.org, fabf@skynet.be
Subject: [PATCH 4/8 linux-next] libnvdimm, namespace: avoid multiple sector calculations
Date: Fri,  2 Dec 2016 20:20:56 +0100	[thread overview]
Message-ID: <1480706456-21111-1-git-send-email-fabf@skynet.be> (raw)

add cleared_sectors variable to add more readability.

Signed-off-by: Fabian Frederick <fabf@skynet.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

             reply	other threads:[~2016-12-02 19:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02 19:20 Fabian Frederick [this message]
2016-12-02 19:20 ` [PATCH 4/8 linux-next] libnvdimm, namespace: avoid multiple sector calculations Fabian Frederick
2016-12-02 20:05 ` Dan Williams
2016-12-02 20:05   ` Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480706456-21111-1-git-send-email-fabf@skynet.be \
    --to=fabf@skynet.be \
    --cc=dan.j.williams@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.