1 dax: call get_blocks() with create == 1 for write faults to unwritten extents
3 From: Jan Kara <jack@suse.cz>
5 Currently, __dax_fault() does not call get_blocks() callback with create
6 argument set, when we got back unwritten extent from the initial
7 get_blocks() call during a write fault. This is because originally
8 filesystems were supposed to convert unwritten extents to written ones
9 using complete_unwritten() callback. Later this was abandoned in favor of
10 using pre-zeroed blocks however the condition whether get_blocks() needs
11 to be called with create == 1 remained.
13 Fix the condition so that filesystems are not forced to zero-out and
14 convert unwritten extents when get_blocks() is called with create == 0
15 (which introduces unnecessary overhead for read faults and can be
16 problematic as the filesystem may possibly be read-only).
18 Signed-off-by: Jan Kara <jack@suse.cz>
19 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
22 1 file changed, 1 insertion(+), 1 deletion(-)
24 diff --git a/fs/dax.c b/fs/dax.c
25 index 75ba46d82a76..2494255c5785 100644
28 @@ -667,7 +667,7 @@ int __dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
32 - if (!buffer_mapped(&bh) && !buffer_unwritten(&bh) && !vmf->cow_page) {
33 + if (!buffer_mapped(&bh) && !vmf->cow_page) {
34 if (vmf->flags & FAULT_FLAG_WRITE) {
35 error = get_block(inode, block, &bh, 1);
36 count_vm_event(PGMAJFAULT);