All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: linux-nvdimm@lists.01.org
Subject: [ndctl PATCH 3/4] ndctl, list: fix span for btt badblocks check
Date: Thu, 11 May 2017 15:01:40 -0700	[thread overview]
Message-ID: <149454010081.30857.7934265050481005763.stgit@dwillia2-desk3.amr.corp.intel.com> (raw)
In-Reply-To: <149454009049.30857.6643219237076670086.stgit@dwillia2-desk3.amr.corp.intel.com>

The size returned by ndctl_btt_get_size() accounts for space consumed by
metadata or otherwise lost to sector size geometry. For the
'badblock_count' property all we can do is report a count of possible
badblocks which may be larger than actual badblocks impacting live data.
Use the raw namespace size for this check.

Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Toshi Kani <toshi.kani@hpe.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 util/json.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/util/json.c b/util/json.c
index f72ffca910ae..17595267c34c 100644
--- a/util/json.c
+++ b/util/json.c
@@ -379,14 +379,14 @@ static void util_btt_badblocks_to_json(struct ndctl_btt *btt,
 {
 	struct ndctl_region *region = ndctl_btt_get_region(btt);
 	struct ndctl_namespace *ndns = ndctl_btt_get_namespace(btt);
-	unsigned long long btt_begin, btt_size;
+	unsigned long long begin, size;
 
-	btt_begin = ndctl_namespace_get_resource(ndns);
-	if (btt_begin == ULLONG_MAX)
+	begin = ndctl_namespace_get_resource(ndns);
+	if (begin == ULLONG_MAX)
 		return;
 
-	btt_size = ndctl_btt_get_size(btt);
-	if (btt_size == ULLONG_MAX)
+	size = ndctl_namespace_get_size(ndns);
+	if (size == ULLONG_MAX)
 		return;
 
 	/*
@@ -397,8 +397,7 @@ static void util_btt_badblocks_to_json(struct ndctl_btt *btt,
 	 * FIXME: switch to native BTT badblocks representation
 	 * when / if the kernel provides it.
 	 */
-	dev_badblocks_to_json(region, btt_begin, btt_size,
-			false, bb_count);
+	dev_badblocks_to_json(region, begin, size, false, bb_count);
 }
 
 static struct json_object *util_dax_badblocks_to_json(struct ndctl_dax *dax,

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

  parent reply	other threads:[~2017-05-11 22:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-11 22:01 [ndctl PATCH 1/4] util: mark badblocks helpers static Dan Williams
2017-05-11 22:01 ` [ndctl PATCH 2/4] ndctl, list: clarify dev_badblocks_to_json() usage with btt and documentation Dan Williams
2017-05-11 22:01 ` Dan Williams [this message]
2017-05-11 22:01 ` [ndctl PATCH 4/4] ndctl, list: hide badblock_count by default Dan Williams
2017-05-11 22:33   ` Kani, Toshimitsu

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=149454010081.30857.7934265050481005763.stgit@dwillia2-desk3.amr.corp.intel.com \
    --to=dan.j.williams@intel.com \
    --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.