Linux-NVDIMM Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Johannes Thumshirn <jthumshirn@suse.de>, dan.j.williams@intel.com
Cc: linux-nvdimm@lists.01.org
Subject: Re: [PATCH 4/5] acpi_nfit, libnvdimm: Add support for clear poison list and bad blocks
Date: Tue, 7 Mar 2017 09:00:58 -0700	[thread overview]
Message-ID: <7c50af6b-558d-76c8-faae-228e224fae75@intel.com> (raw)
In-Reply-To: <ca401cc3-db44-32a7-ecc5-2c06c0322177@suse.de>

On 03/07/2017 02:30 AM, Johannes Thumshirn wrote:
> On 03/06/2017 09:32 PM, Dave Jiang wrote:
>> Providing mechanism to clear poison list via the ndctl ND_CMD_CLEAR_ERROR
>> call. We will update the poison list and also the badblocks at region level
>> if the region is in dax mode or in pmem mode and not active.
>>
>> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
>> ---
> 
> [...]
> 
>> +	if ((cmd != ND_CMD_CLEAR_ERROR) || !nvdimm_bus || !clear_err->cleared)
>              ^~ Unnecessary parenthesis?
> 
> [...]
> 
>> +
>> +		/* make sure clear_err range is within a SPA range */
>> +		if (((clear_begin >= spa_begin) &&
>> +					(clear_begin < (spa_end))) &&
>> +				((clear_end > spa_begin) &&
>> +				 (clear_end <= spa_end))) {
> 
> Indentation looks a bit odd here and the superfluous parenthesis aren't
> improving the situation.
> 
> [...]

I'll fix that.

> 
> 
>> +	if (nd_btt || nd_pfn || nd_dax) {
>> +		if (nd_btt)
>> +			ndns = nd_btt->ndns;
>> +		else if (nd_pfn)
>> +			ndns = nd_pfn->ndns;
>> +		else if (nd_dax)
>> +			ndns = nd_dax->nd_pfn.ndns;
>> +
>> +		if (!ndns)
>> +			return 0;
> 
> How can this (the !ndns case) ever happen?

So if nd_btt->ndns or nd_pfn->ndns or nd_dax->nd_pfn.ndns happens to be
NULL, then this case can happen. I don't know how likely that is to
happen however. The code was lifted from nvdimm_namespace_common_probe().

> 
> And anyways isn't this sufficient, or am I missing something:
> 
> 	if (nd_btt)
> 		ndns = nd_btt->ndns;
> 	else if (nd_pfn)
> 		ndns = nd_pfn->ndns;
> 	else if (nd_dax)
> 		ndns = nd_dax->nd_pfn.ndns;
> 	else
> 		ndns = to_ndns(dev);
> 
>> +	} else
>> +		ndns = to_ndns(dev);
>> +
> 
> Thanks,
> 	Johannes
> 
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2017-03-07 16:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06 20:32 [PATCH 0/5] Adding clear poison path for device DAX Dave Jiang
2017-03-06 20:32 ` [PATCH 1/5] libnvdimm: Add mechanism to publish badblocks at nd region level Dave Jiang
2017-03-07  8:58   ` Johannes Thumshirn
2017-03-06 20:32 ` [PATCH 2/5] libnvdimm: Add resource sysfs attrib to nd region Dave Jiang
2017-03-07  8:59   ` Johannes Thumshirn
2017-03-06 20:32 ` [PATCH 3/5] acpi: cleanup acpi_nfit_ctl calling xlat_status Dave Jiang
2017-03-08  0:20   ` Linda Knippers
2017-03-08 16:29     ` Dave Jiang
2017-03-08 16:51       ` Linda Knippers
2017-03-08 17:10         ` Dan Williams
2017-03-06 20:32 ` [PATCH 4/5] acpi_nfit, libnvdimm: Add support for clear poison list and bad blocks Dave Jiang
2017-03-07  9:30   ` Johannes Thumshirn
2017-03-07 16:00     ` Dave Jiang [this message]
2017-03-07 16:11       ` Johannes Thumshirn
2017-03-06 20:32 ` [PATCH 5/5] libnvdimm: providing dax support for nvdimm testing Dave Jiang
2017-03-07  9:31   ` Johannes Thumshirn

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=7c50af6b-558d-76c8-faae-228e224fae75@intel.com \
    --to=dave.jiang@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=jthumshirn@suse.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox