diff options
author | Takashi Iwai <tiwai@suse.de> | 2016-02-10 01:08:37 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-02-10 01:08:37 +0300 |
commit | 397da2d0ab0d1398242622d80a74df7245395c63 (patch) | |
tree | 51e01a67c653c67108f65d063b8b9cbfacf0b1a7 /block/partition-generic.c | |
parent | b8cb3750ce94d7610934465263850dcf40736bca (diff) | |
parent | 4dff5c7b7093b19c19d3a100f8a3ad87cb7cd9e7 (diff) | |
download | linux-397da2d0ab0d1398242622d80a74df7245395c63.tar.xz |
Merge branch 'topic/core-fixes' into for-linus
Diffstat (limited to 'block/partition-generic.c')
-rw-r--r-- | block/partition-generic.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/block/partition-generic.c b/block/partition-generic.c index 746935a5973c..fefd01b496a0 100644 --- a/block/partition-generic.c +++ b/block/partition-generic.c @@ -16,6 +16,7 @@ #include <linux/kmod.h> #include <linux/ctype.h> #include <linux/genhd.h> +#include <linux/dax.h> #include <linux/blktrace_api.h> #include "partitions/check.h" @@ -550,13 +551,24 @@ int invalidate_partitions(struct gendisk *disk, struct block_device *bdev) return 0; } -unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p) +static struct page *read_pagecache_sector(struct block_device *bdev, sector_t n) { struct address_space *mapping = bdev->bd_inode->i_mapping; + + return read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_CACHE_SHIFT-9)), + NULL); +} + +unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p) +{ struct page *page; - page = read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_CACHE_SHIFT-9)), - NULL); + /* don't populate page cache for dax capable devices */ + if (IS_DAX(bdev->bd_inode)) + page = read_dax_sector(bdev, n); + else + page = read_pagecache_sector(bdev, n); + if (!IS_ERR(page)) { if (PageError(page)) goto fail; |