Commit 9484ab1b authored by Jan Kara's avatar Jan Kara Committed by Dave Chinner

dax: Introduce IOMAP_FAULT flag

Introduce a flag telling iomap operations whether they are handling a
fault or other IO. That may influence behavior wrt inode size and
similar things.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 190b5caa
...@@ -1266,7 +1266,7 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf, ...@@ -1266,7 +1266,7 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
loff_t pos = (loff_t)vmf->pgoff << PAGE_SHIFT; loff_t pos = (loff_t)vmf->pgoff << PAGE_SHIFT;
sector_t sector; sector_t sector;
struct iomap iomap = { 0 }; struct iomap iomap = { 0 };
unsigned flags = 0; unsigned flags = IOMAP_FAULT;
int error, major = 0; int error, major = 0;
int locked_status = 0; int locked_status = 0;
void *entry; void *entry;
...@@ -1467,7 +1467,7 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address, ...@@ -1467,7 +1467,7 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address,
struct address_space *mapping = vma->vm_file->f_mapping; struct address_space *mapping = vma->vm_file->f_mapping;
unsigned long pmd_addr = address & PMD_MASK; unsigned long pmd_addr = address & PMD_MASK;
bool write = flags & FAULT_FLAG_WRITE; bool write = flags & FAULT_FLAG_WRITE;
unsigned int iomap_flags = write ? IOMAP_WRITE : 0; unsigned int iomap_flags = (write ? IOMAP_WRITE : 0) | IOMAP_FAULT;
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
int result = VM_FAULT_FALLBACK; int result = VM_FAULT_FALLBACK;
struct iomap iomap = { 0 }; struct iomap iomap = { 0 };
......
...@@ -468,8 +468,9 @@ int iomap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, ...@@ -468,8 +468,9 @@ int iomap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
offset = page_offset(page); offset = page_offset(page);
while (length > 0) { while (length > 0) {
ret = iomap_apply(inode, offset, length, IOMAP_WRITE, ret = iomap_apply(inode, offset, length,
ops, page, iomap_page_mkwrite_actor); IOMAP_WRITE | IOMAP_FAULT, ops, page,
iomap_page_mkwrite_actor);
if (unlikely(ret <= 0)) if (unlikely(ret <= 0))
goto out_unlock; goto out_unlock;
offset += ret; offset += ret;
......
...@@ -44,6 +44,7 @@ struct iomap { ...@@ -44,6 +44,7 @@ struct iomap {
*/ */
#define IOMAP_WRITE (1 << 0) #define IOMAP_WRITE (1 << 0)
#define IOMAP_ZERO (1 << 1) #define IOMAP_ZERO (1 << 1)
#define IOMAP_FAULT (1 << 3) /* mapping for page fault */
struct iomap_ops { struct iomap_ops {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment