diff options
author | Dan Williams <dan.j.williams@intel.com> | 2016-02-24 17:02:11 -0500 |
---|---|---|
committer | Vishal Verma <vishal.l.verma@intel.com> | 2016-05-18 14:16:56 -0400 |
commit | 0a70bd43053331d99881211e1d09f32de531432f (patch) | |
tree | 1f63c6ece9c22c30a99c19fd91a14dc1556dc7f6 /fs | |
parent | 8b3db9798c689ba2dc509f6ca1a8c7e1c1a3e62a (diff) |
dax: enable dax in the presence of known media errors (badblocks)
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.
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
[vishal: fix a conflict with system RAM collision patches]
[vishal: add a 'size' parameter to ->direct_access]
[vishal: fix a conflict with DAX alignment check patches]
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/block_dev.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 8477d4501b1e..45839b27972c 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/log2.h> | 29 | #include <linux/log2.h> |
30 | #include <linux/cleancache.h> | 30 | #include <linux/cleancache.h> |
31 | #include <linux/dax.h> | 31 | #include <linux/dax.h> |
32 | #include <linux/badblocks.h> | ||
33 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
34 | #include "internal.h" | 33 | #include "internal.h" |
35 | 34 | ||
@@ -501,7 +500,7 @@ long bdev_direct_access(struct block_device *bdev, struct blk_dax_ctl *dax) | |||
501 | sector += get_start_sect(bdev); | 500 | sector += get_start_sect(bdev); |
502 | if (sector % (PAGE_SIZE / 512)) | 501 | if (sector % (PAGE_SIZE / 512)) |
503 | return -EINVAL; | 502 | return -EINVAL; |
504 | avail = ops->direct_access(bdev, sector, &dax->addr, &dax->pfn); | 503 | avail = ops->direct_access(bdev, sector, &dax->addr, &dax->pfn, size); |
505 | if (!avail) | 504 | if (!avail) |
506 | return -ERANGE; | 505 | return -ERANGE; |
507 | if (avail > 0 && avail & ~PAGE_MASK) | 506 | if (avail > 0 && avail & ~PAGE_MASK) |
@@ -561,7 +560,6 @@ EXPORT_SYMBOL_GPL(bdev_dax_supported); | |||
561 | */ | 560 | */ |
562 | bool bdev_dax_capable(struct block_device *bdev) | 561 | bool bdev_dax_capable(struct block_device *bdev) |
563 | { | 562 | { |
564 | struct gendisk *disk = bdev->bd_disk; | ||
565 | struct blk_dax_ctl dax = { | 563 | struct blk_dax_ctl dax = { |
566 | .size = PAGE_SIZE, | 564 | .size = PAGE_SIZE, |
567 | }; | 565 | }; |
@@ -577,15 +575,6 @@ bool bdev_dax_capable(struct block_device *bdev) | |||
577 | if (bdev_direct_access(bdev, &dax) < 0) | 575 | if (bdev_direct_access(bdev, &dax) < 0) |
578 | return false; | 576 | return false; |
579 | 577 | ||
580 | /* | ||
581 | * If the device has known bad blocks, force all I/O through the | ||
582 | * driver / page cache. | ||
583 | * | ||
584 | * TODO: support finer grained dax error handling | ||
585 | */ | ||
586 | if (disk->bb && disk->bb->count) | ||
587 | return false; | ||
588 | |||
589 | return true; | 578 | return true; |
590 | } | 579 | } |
591 | 580 | ||