aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2017-01-27 17:13:15 -0500
committerDan Williams <dan.j.williams@intel.com>2017-04-25 16:20:46 -0400
commita41fe02b6bba853a29c864d00fd161bbe6cfc715 (patch)
tree7060e9ed2234c8b6b2cc99523f18ed66bddba33a
parentfa5d932c323e8e0d9b24b3517997d15b36d1607d (diff)
Revert "block: use DAX for partition table reads"
commit d1a5f2b4d8a1 ("block: use DAX for partition table reads") was part of a stalled effort to allow dax mappings of block devices. Since then the device-dax mechanism has filled the role of dax-mapping static device ranges. Now that we are moving ->direct_access() from a block_device operation to a dax_inode operation we would need block devices to map and carry their own dax_inode reference. Unless / until we decide to revive dax mapping of raw block devices through the dax_inode scheme, there is no need to carry read_dax_sector(). Its removal in turn allows for the removal of bdev_direct_access() and should have been included in commit 223757016837 ("block_dev: remove DAX leftovers"). Cc: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--block/partition-generic.c17
-rw-r--r--fs/dax.c20
-rw-r--r--include/linux/dax.h6
3 files changed, 2 insertions, 41 deletions
diff --git a/block/partition-generic.c b/block/partition-generic.c
index 7afb9907821f..5dfac337b0f2 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -16,7 +16,6 @@
16#include <linux/kmod.h> 16#include <linux/kmod.h>
17#include <linux/ctype.h> 17#include <linux/ctype.h>
18#include <linux/genhd.h> 18#include <linux/genhd.h>
19#include <linux/dax.h>
20#include <linux/blktrace_api.h> 19#include <linux/blktrace_api.h>
21 20
22#include "partitions/check.h" 21#include "partitions/check.h"
@@ -631,24 +630,12 @@ int invalidate_partitions(struct gendisk *disk, struct block_device *bdev)
631 return 0; 630 return 0;
632} 631}
633 632
634static struct page *read_pagecache_sector(struct block_device *bdev, sector_t n)
635{
636 struct address_space *mapping = bdev->bd_inode->i_mapping;
637
638 return read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_SHIFT-9)),
639 NULL);
640}
641
642unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p) 633unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p)
643{ 634{
635 struct address_space *mapping = bdev->bd_inode->i_mapping;
644 struct page *page; 636 struct page *page;
645 637
646 /* don't populate page cache for dax capable devices */ 638 page = read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_SHIFT-9)), NULL);
647 if (IS_DAX(bdev->bd_inode))
648 page = read_dax_sector(bdev, n);
649 else
650 page = read_pagecache_sector(bdev, n);
651
652 if (!IS_ERR(page)) { 639 if (!IS_ERR(page)) {
653 if (PageError(page)) 640 if (PageError(page))
654 goto fail; 641 goto fail;
diff --git a/fs/dax.c b/fs/dax.c
index de622d4282a6..b78a6947c4f5 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -101,26 +101,6 @@ static int dax_is_empty_entry(void *entry)
101 return (unsigned long)entry & RADIX_DAX_EMPTY; 101 return (unsigned long)entry & RADIX_DAX_EMPTY;
102} 102}
103 103
104struct page *read_dax_sector(struct block_device *bdev, sector_t n)
105{
106 struct page *page = alloc_pages(GFP_KERNEL, 0);
107 struct blk_dax_ctl dax = {
108 .size = PAGE_SIZE,
109 .sector = n & ~((((int) PAGE_SIZE) / 512) - 1),
110 };
111 long rc;
112
113 if (!page)
114 return ERR_PTR(-ENOMEM);
115
116 rc = dax_map_atomic(bdev, &dax);
117 if (rc < 0)
118 return ERR_PTR(rc);
119 memcpy_from_pmem(page_address(page), dax.addr, PAGE_SIZE);
120 dax_unmap_atomic(bdev, &dax);
121 return page;
122}
123
124/* 104/*
125 * DAX radix tree locking 105 * DAX radix tree locking
126 */ 106 */
diff --git a/include/linux/dax.h b/include/linux/dax.h
index 7e62e280c11f..0d0d890f9186 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -70,15 +70,9 @@ void dax_wake_mapping_entry_waiter(struct address_space *mapping,
70 pgoff_t index, void *entry, bool wake_all); 70 pgoff_t index, void *entry, bool wake_all);
71 71
72#ifdef CONFIG_FS_DAX 72#ifdef CONFIG_FS_DAX
73struct page *read_dax_sector(struct block_device *bdev, sector_t n);
74int __dax_zero_page_range(struct block_device *bdev, sector_t sector, 73int __dax_zero_page_range(struct block_device *bdev, sector_t sector,
75 unsigned int offset, unsigned int length); 74 unsigned int offset, unsigned int length);
76#else 75#else
77static inline struct page *read_dax_sector(struct block_device *bdev,
78 sector_t n)
79{
80 return ERR_PTR(-ENXIO);
81}
82static inline int __dax_zero_page_range(struct block_device *bdev, 76static inline int __dax_zero_page_range(struct block_device *bdev,
83 sector_t sector, unsigned int offset, unsigned int length) 77 sector_t sector, unsigned int offset, unsigned int length)
84{ 78{