diff options
Diffstat (limited to 'fs/dax.c')
-rw-r--r-- | fs/dax.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -319,6 +319,12 @@ static int dax_insert_mapping(struct inode *inode, struct buffer_head *bh, | |||
319 | * @vma: The virtual memory area where the fault occurred | 319 | * @vma: The virtual memory area where the fault occurred |
320 | * @vmf: The description of the fault | 320 | * @vmf: The description of the fault |
321 | * @get_block: The filesystem method used to translate file offsets to blocks | 321 | * @get_block: The filesystem method used to translate file offsets to blocks |
322 | * @complete_unwritten: The filesystem method used to convert unwritten blocks | ||
323 | * to written so the data written to them is exposed. This is required for | ||
324 | * required by write faults for filesystems that will return unwritten | ||
325 | * extent mappings from @get_block, but it is optional for reads as | ||
326 | * dax_insert_mapping() will always zero unwritten blocks. If the fs does | ||
327 | * not support unwritten extents, the it should pass NULL. | ||
322 | * | 328 | * |
323 | * When a page fault occurs, filesystems may call this helper in their | 329 | * When a page fault occurs, filesystems may call this helper in their |
324 | * fault handler for DAX files. __dax_fault() assumes the caller has done all | 330 | * fault handler for DAX files. __dax_fault() assumes the caller has done all |
@@ -437,8 +443,12 @@ int __dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
437 | * as for normal BH based IO completions. | 443 | * as for normal BH based IO completions. |
438 | */ | 444 | */ |
439 | error = dax_insert_mapping(inode, &bh, vma, vmf); | 445 | error = dax_insert_mapping(inode, &bh, vma, vmf); |
440 | if (buffer_unwritten(&bh)) | 446 | if (buffer_unwritten(&bh)) { |
441 | complete_unwritten(&bh, !error); | 447 | if (complete_unwritten) |
448 | complete_unwritten(&bh, !error); | ||
449 | else | ||
450 | WARN_ON_ONCE(!(vmf->flags & FAULT_FLAG_WRITE)); | ||
451 | } | ||
442 | 452 | ||
443 | out: | 453 | out: |
444 | if (error == -ENOMEM) | 454 | if (error == -ENOMEM) |