2015-06-29 20:02:31

by Matthew Wilcox

[permalink] [raw]
Subject: [PATCH 4/5] ext4: Use ext4_get_block_write() for DAX

From: Matthew Wilcox <[email protected]>

DAX relies on the get_block function either zeroing newly allocated blocks
before they're findable by subsequent calls to get_block, or marking newly
allocated blocks as unwritten. ext4_get_block() cannot create unwritten
extents, but ext4_get_block_write() can.

Reported-by: Andy Rudoff <[email protected]>
Signed-off-by: Matthew Wilcox <[email protected]>
---
fs/ext4/file.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index ac517f1..f66f3da 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -194,13 +194,12 @@ out:
#ifdef CONFIG_FS_DAX
static int ext4_dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
{
- return dax_fault(vma, vmf, ext4_get_block);
- /* Is this the right get_block? */
+ return dax_fault(vma, vmf, ext4_get_block_write);
}

static int ext4_dax_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
{
- return dax_mkwrite(vma, vmf, ext4_get_block);
+ return dax_mkwrite(vma, vmf, ext4_get_block_write);
}

static const struct vm_operations_struct ext4_dax_vm_ops = {
--
2.1.4