|
@@ -16,6 +16,7 @@
|
|
#include <linux/kmod.h>
|
|
#include <linux/kmod.h>
|
|
#include <linux/ctype.h>
|
|
#include <linux/ctype.h>
|
|
#include <linux/genhd.h>
|
|
#include <linux/genhd.h>
|
|
|
|
+#include <linux/dax.h>
|
|
#include <linux/blktrace_api.h>
|
|
#include <linux/blktrace_api.h>
|
|
|
|
|
|
#include "partitions/check.h"
|
|
#include "partitions/check.h"
|
|
@@ -550,13 +551,24 @@ int invalidate_partitions(struct gendisk *disk, struct block_device *bdev)
|
|
return 0;
|
|
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;
|
|
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;
|
|
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 (!IS_ERR(page)) {
|
|
if (PageError(page))
|
|
if (PageError(page))
|
|
goto fail;
|
|
goto fail;
|