Skip to content

Commit 9484ab1

Browse files
jankaradchinner
authored andcommitted
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: Jan Kara <jack@suse.cz> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com>
1 parent 190b5ca commit 9484ab1

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

fs/dax.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
12661266
loff_t pos = (loff_t)vmf->pgoff << PAGE_SHIFT;
12671267
sector_t sector;
12681268
struct iomap iomap = { 0 };
1269-
unsigned flags = 0;
1269+
unsigned flags = IOMAP_FAULT;
12701270
int error, major = 0;
12711271
int locked_status = 0;
12721272
void *entry;
@@ -1467,7 +1467,7 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address,
14671467
struct address_space *mapping = vma->vm_file->f_mapping;
14681468
unsigned long pmd_addr = address & PMD_MASK;
14691469
bool write = flags & FAULT_FLAG_WRITE;
1470-
unsigned int iomap_flags = write ? IOMAP_WRITE : 0;
1470+
unsigned int iomap_flags = (write ? IOMAP_WRITE : 0) | IOMAP_FAULT;
14711471
struct inode *inode = mapping->host;
14721472
int result = VM_FAULT_FALLBACK;
14731473
struct iomap iomap = { 0 };

fs/iomap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,9 @@ int iomap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
468468

469469
offset = page_offset(page);
470470
while (length > 0) {
471-
ret = iomap_apply(inode, offset, length, IOMAP_WRITE,
472-
ops, page, iomap_page_mkwrite_actor);
471+
ret = iomap_apply(inode, offset, length,
472+
IOMAP_WRITE | IOMAP_FAULT, ops, page,
473+
iomap_page_mkwrite_actor);
473474
if (unlikely(ret <= 0))
474475
goto out_unlock;
475476
offset += ret;

include/linux/iomap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ struct iomap {
4444
*/
4545
#define IOMAP_WRITE (1 << 0)
4646
#define IOMAP_ZERO (1 << 1)
47+
#define IOMAP_FAULT (1 << 3) /* mapping for page fault */
4748

4849
struct iomap_ops {
4950
/*

0 commit comments

Comments
 (0)