All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Williams, Dan J" <dan.j.williams@intel.com>,
	"Jiang, Dave" <dave.jiang@intel.com>
Cc: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [PATCH] dev-dax: add support to display badblocks in sysfs for dev-dax
Date: Wed, 28 Sep 2016 18:57:42 +0000	[thread overview]
Message-ID: <1475089016.2482.3.camel@intel.com> (raw)
In-Reply-To: <147508875131.91583.12624254404354366550.stgit@djiang5-desk3.ch.intel.com>

On Wed, 2016-09-28 at 11:52 -0700, Dave Jiang wrote:
> Adding support to show badblocks in the pmem region that's provided
> by the poison_list. This should show up in
> /sys/class/dax/daxN.N/badblocks as read only.

I think we can allow error injection by making this read/write. See
badblocks_store and how it is used in disk_badblocks_store, and that
will allow badblock injection for testing/debug purposes.

> 
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  drivers/dax/dax.c |   20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c
> index 29f600f..c73c494 100644
> --- a/drivers/dax/dax.c
> +++ b/drivers/dax/dax.c
> @@ -18,6 +18,8 @@
>  #include <linux/dax.h>
>  #include <linux/fs.h>
>  #include <linux/mm.h>
> +#include <linux/badblocks.h>
> +#include "../nvdimm/nd.h"
>  
>  static int dax_major;
>  static struct class *dax_class;
> @@ -42,6 +44,7 @@ struct dax_region {
>  	unsigned int align;
>  	struct resource res;
>  	unsigned long pfn_flags;
> +	struct badblocks bb;
>  };
>  
>  /**
> @@ -97,6 +100,7 @@ struct dax_region *alloc_dax_region(struct device
> *parent, int region_id,
>  		unsigned long pfn_flags)
>  {
>  	struct dax_region *dax_region;
> +	struct nd_region *nd_region = to_nd_region(parent->parent);
>  
>  	dax_region = kzalloc(sizeof(*dax_region), GFP_KERNEL);
>  
> @@ -112,6 +116,10 @@ struct dax_region *alloc_dax_region(struct device
> *parent, int region_id,
>  	dax_region->dev = parent;
>  	dax_region->base = addr;
>  
> +	if (devm_init_badblocks(parent, &dax_region->bb))
> +		return NULL;
> +	nvdimm_badblocks_populate(nd_region, &dax_region->bb, res);
> +
>  	return dax_region;
>  }
>  EXPORT_SYMBOL_GPL(alloc_dax_region);
> @@ -130,8 +138,20 @@ static ssize_t size_show(struct device *dev,
>  }
>  static DEVICE_ATTR_RO(size);
>  
> +static ssize_t dax_dev_badblocks_show(struct device *dev,
> +		struct device_attribute *attr, char *page)
> +{
> +	struct dax_dev *dax_dev = dev_get_drvdata(dev);
> +	struct dax_region *dax_region = dax_dev->region;
> +
> +	return badblocks_show(&dax_region->bb, page, 0);
> +}
> +
> +static DEVICE_ATTR(badblocks, S_IRUGO, dax_dev_badblocks_show, NULL);
> +
>  static struct attribute *dax_device_attributes[] = {
>  	&dev_attr_size.attr,
> +	&dev_attr_badblocks.attr,
>  	NULL,
>  };
>  
> 
> _______________________________________________
> Linux-nvdimm mailing list
> Linux-nvdimm@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2016-09-28 18:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-28 18:52 [PATCH] dev-dax: add support to display badblocks in sysfs for dev-dax Dave Jiang
2016-09-28 18:57 ` Verma, Vishal L [this message]
2016-09-28 20:50 ` 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=1475089016.2482.3.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@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.