[PATCH 4/7] dax: Unwritten extents don't set the mapped flag

From: Matthew Wilcox
Date: Wed Sep 24 2014 - 13:53:24 EST


Despite an unwritten extent having a defined mapping, buffer_mapped()
returns false. We don't need to call get_block() again here, since
we know wat the disk block is that corresponds to this file offset.
---
fs/dax.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/dax.c b/fs/dax.c
index b130b47..59be664 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -366,7 +366,7 @@ static int do_dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
if (error)
goto unlock_page;

- if (!buffer_mapped(&bh) && !vmf->cow_page) {
+ if (!buffer_mapped(&bh) && !buffer_unwritten(&bh) && !vmf->cow_page) {
if (vmf->flags & FAULT_FLAG_WRITE) {
error = get_block(inode, block, &bh, 1);
count_vm_event(PGMAJFAULT);
--
2.1.0


--cNdxnHkX5QqsyA0e
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0005-ext4-Add-a-callback-to-convert-unwritten-extents.patch"