summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>2015-09-08 23:59:34 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-09 00:35:28 +0200
commitd295e3415a88ae63a37a22652808b20c7fcb970e (patch)
treea4b702c5e99fc2c137ac2512c8ce02bd729e2556 /fs
parentthp: fix zap_huge_pmd() for DAX (diff)
downloadlinux-d295e3415a88ae63a37a22652808b20c7fcb970e.tar.xz
linux-d295e3415a88ae63a37a22652808b20c7fcb970e.zip
dax: don't use set_huge_zero_page()
This is another place where DAX assumed that pgtable_t was a pointer. Open code the important parts of set_huge_zero_page() in DAX and make set_huge_zero_page() static again. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/dax.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/fs/dax.c b/fs/dax.c
index 9593f4bee327..d778e5f1a01c 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -572,18 +572,24 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
unmap_mapping_range(mapping, pgoff << PAGE_SHIFT, PMD_SIZE, 0);
if (!write && !buffer_mapped(&bh) && buffer_uptodate(&bh)) {
- bool set;
spinlock_t *ptl;
- struct mm_struct *mm = vma->vm_mm;
+ pmd_t entry;
struct page *zero_page = get_huge_zero_page();
+
if (unlikely(!zero_page))
goto fallback;
- ptl = pmd_lock(mm, pmd);
- set = set_huge_zero_page(NULL, mm, vma, pmd_addr, pmd,
- zero_page);
- spin_unlock(ptl);
+ ptl = pmd_lock(vma->vm_mm, pmd);
+ if (!pmd_none(*pmd)) {
+ spin_unlock(ptl);
+ goto fallback;
+ }
+
+ entry = mk_pmd(zero_page, vma->vm_page_prot);
+ entry = pmd_mkhuge(entry);
+ set_pmd_at(vma->vm_mm, pmd_addr, pmd, entry);
result = VM_FAULT_NOPAGE;
+ spin_unlock(ptl);
} else {
sector = bh.b_blocknr << (blkbits - 9);
length = bdev_direct_access(bh.b_bdev, sector, &kaddr, &pfn,