Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1366856

[PATCH v2 3/5] dax: enable dax in the presence of known media errors (badblocks)

From Vishal Verma <vishal.l.verma@intel.com>
Newsgroups linux.kernel
Subject [PATCH v2 3/5] dax: enable dax in the presence of known media errors (badblocks)
Date 2016-03-30 04:10 +0200
Message-ID <ridK1-6VB-7@gated-at.bofh.it> (permalink)
References <ridK1-6VB-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Dan Williams <dan.j.williams@intel.com>

1/ If a mapping overlaps a bad sector fail the request.

2/ Do not opportunistically report more dax-capable capacity than is
   requested when errors present.

[vishal: fix a conflict with system RAM collision patches]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 block/ioctl.c         | 9 ---------
 drivers/nvdimm/pmem.c | 8 ++++++++
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/block/ioctl.c b/block/ioctl.c
index d8996bb..cd7f392 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -423,15 +423,6 @@ bool blkdev_dax_capable(struct block_device *bdev)
 			|| (bdev->bd_part->nr_sects % (PAGE_SIZE / 512)))
 		return false;
 
-	/*
-	 * If the device has known bad blocks, force all I/O through the
-	 * driver / page cache.
-	 *
-	 * TODO: support finer grained dax error handling
-	 */
-	if (disk->bb && disk->bb->count)
-		return false;
-
 	return true;
 }
 #endif
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index da10554..eac5f93 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -174,9 +174,17 @@ static long pmem_direct_access(struct block_device *bdev,
 	struct pmem_device *pmem = bdev->bd_disk->private_data;
 	resource_size_t offset = sector * 512 + pmem->data_offset;
 
+	if (unlikely(is_bad_pmem(&pmem->bb, sector, dax->size)))
+		return -EIO;
 	dax->addr = pmem->virt_addr + offset;
 	dax->pfn = phys_to_pfn_t(pmem->phys_addr + offset, pmem->pfn_flags);
 
+	/*
+	 * If badblocks are present, limit known good range to the
+	 * requested range.
+	 */
+	if (unlikely(pmem->bb.count))
+		return dax->size;
 	return pmem->size - pmem->pfn_pad - offset;
 }
 
-- 
2.5.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/5] dax: handling of media errors Vishal Verma <vishal.l.verma@intel.com> - 2016-03-30 04:10 +0200
  [PATCH v2 3/5] dax: enable dax in the presence of known media errors (badblocks) Vishal Verma <vishal.l.verma@intel.com> - 2016-03-30 04:10 +0200
  [PATCH v2 4/5] dax: use sb_issue_zerout instead of calling dax_clear_sectors Vishal Verma <vishal.l.verma@intel.com> - 2016-03-30 04:10 +0200
  [PATCH v2 1/5] block, dax: pass blk_dax_ctl through to drivers Vishal Verma <vishal.l.verma@intel.com> - 2016-03-30 04:10 +0200
    Re: [PATCH v2 1/5] block, dax: pass blk_dax_ctl through to drivers kbuild test robot <lkp@intel.com> - 2016-03-30 06:30 +0200
  [PATCH v2 2/5] dax: fallback from pmd to pte on error Vishal Verma <vishal.l.verma@intel.com> - 2016-03-30 04:10 +0200
  [PATCH v2 5/5] dax: handle media errors in dax_do_io Vishal Verma <vishal.l.verma@intel.com> - 2016-03-30 04:10 +0200
    Re: [PATCH v2 5/5] dax: handle media errors in dax_do_io Christoph Hellwig <hch@infradead.org> - 2016-03-30 08:40 +0200
      Re: [PATCH v2 5/5] dax: handle media errors in dax_do_io Vishal Verma <vishal@kernel.org> - 2016-03-30 09:00 +0200
        Re: [PATCH v2 5/5] dax: handle media errors in dax_do_io Christoph Hellwig <hch@infradead.org> - 2016-03-30 09:00 +0200

csiph-web