Skip to content

Commit a41fe02

Browse files
committed
Revert "block: use DAX for partition table reads"
commit d1a5f2b ("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 2237570 ("block_dev: remove DAX leftovers"). Cc: Jeff Moyer <[email protected]> Signed-off-by: Dan Williams <[email protected]>
1 parent fa5d932 commit a41fe02

File tree

3 files changed

+2
-41
lines changed

3 files changed

+2
-41
lines changed

block/partition-generic.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <linux/kmod.h>
1717
#include <linux/ctype.h>
1818
#include <linux/genhd.h>
19-
#include <linux/dax.h>
2019
#include <linux/blktrace_api.h>
2120

2221
#include "partitions/check.h"
@@ -631,24 +630,12 @@ int invalidate_partitions(struct gendisk *disk, struct block_device *bdev)
631630
return 0;
632631
}
633632

634-
static 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-
642633
unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p)
643634
{
635+
struct address_space *mapping = bdev->bd_inode->i_mapping;
644636
struct page *page;
645637

646-
/* don't populate page cache for dax capable devices */
647-
if (IS_DAX(bdev->bd_inode))
648-
page = read_dax_sector(bdev, n);
649-
else
650-
page = read_pagecache_sector(bdev, n);
651-
638+
page = read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_SHIFT-9)), NULL);
652639
if (!IS_ERR(page)) {
653640
if (PageError(page))
654641
goto fail;

fs/dax.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -101,26 +101,6 @@ static int dax_is_empty_entry(void *entry)
101101
return (unsigned long)entry & RADIX_DAX_EMPTY;
102102
}
103103

104-
struct 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-
124104
/*
125105
* DAX radix tree locking
126106
*/

include/linux/dax.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,9 @@ void dax_wake_mapping_entry_waiter(struct address_space *mapping,
7070
pgoff_t index, void *entry, bool wake_all);
7171

7272
#ifdef CONFIG_FS_DAX
73-
struct page *read_dax_sector(struct block_device *bdev, sector_t n);
7473
int __dax_zero_page_range(struct block_device *bdev, sector_t sector,
7574
unsigned int offset, unsigned int length);
7675
#else
77-
static inline struct page *read_dax_sector(struct block_device *bdev,
78-
sector_t n)
79-
{
80-
return ERR_PTR(-ENXIO);
81-
}
8276
static inline int __dax_zero_page_range(struct block_device *bdev,
8377
sector_t sector, unsigned int offset, unsigned int length)
8478
{

0 commit comments

Comments
 (0)