Message ID | 20181003181506.17682-4-vishal.l.verma@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [ndctl,v2,1/5] ndctl, lib: refactor badblocks retrieval routines | expand |
On Wed, 2018-10-03 at 12:15 -0600, Vishal Verma wrote: > Add comments to clarify that in the various ndctl_*_babdlock_foreach > loops where we compose the json output, the additional check for > UTIL_JSON_MEDIA_ERRORS is valid because even if we're not printing > media errors, we still want the badblock_count to be updated, which > requires a full badblocks traversal. > > Cc: Dan Williams <dan.j.williams@intel.com> > Suggested-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> ...and everything else looks good too in this series.
diff --git a/util/json.c b/util/json.c index 30b56c3..702ccf4 100644 --- a/util/json.c +++ b/util/json.c @@ -465,6 +465,7 @@ struct json_object *util_region_badblocks_to_json(struct ndctl_region *region, bbs += bb->len; + /* recheck so we can still get the badblocks_count from above */ if (!(flags & UTIL_JSON_MEDIA_ERRORS)) continue; @@ -554,6 +555,7 @@ static struct json_object *dev_badblocks_to_json(struct ndctl_region *region, bbs += len; + /* recheck so we can still get the badblocks_count from above */ if (!(flags & UTIL_JSON_MEDIA_ERRORS)) continue;
Add comments to clarify that in the various ndctl_*_babdlock_foreach loops where we compose the json output, the additional check for UTIL_JSON_MEDIA_ERRORS is valid because even if we're not printing media errors, we still want the badblock_count to be updated, which requires a full badblocks traversal. Cc: Dan Williams <dan.j.williams@intel.com> Suggested-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> --- util/json.c | 2 ++ 1 file changed, 2 insertions(+)