[PATCH 1/4] xfs: call dax_fault on read page faults for DAX

Matthew Wilcox willy at linux.intel.com
Tue Jul 21 08:57:58 CDT 2015


On Tue, Jul 21, 2015 at 11:09:02AM +1000, Dave Chinner wrote:
> @@ -339,6 +344,8 @@ int __dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
>  	int error;
>  	int major = 0;
>  
> +	WARN_ON_ONCE((vmf->flags & FAULT_FLAG_WRITE) && !complete_unwritten);
> +
>  	size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT;
>  	if (vmf->pgoff >= size)
>  		return VM_FAULT_SIGBUS;

This warning is always going to trigger for ext2, since it doesn't
support the concept of unwritten extents.  Instead, ext2 zeroes the block
before linking it into the tree and returning from get_block.

> @@ -437,7 +444,7 @@ int __dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
>  	 * as for normal BH based IO completions.
>  	 */
>  	error = dax_insert_mapping(inode, &bh, vma, vmf);
> -	if (buffer_unwritten(&bh))
> +	if (buffer_unwritten(&bh) && complete_unwritten)
>  		complete_unwritten(&bh, !error);
>  
>   out:

... so maybe we should do something here like:

	if (buffer_unwritten(&bh)) {
		if (complete_unwritten)
			complete_unwritten(&bh, !error);
		else
			BUG_ON(vmf->flags & FAULT_FLAG_WRITE);
	}

(the XFS changes look fine to me)



More information about the xfs mailing list