dax: Introduce IOMAP_FAULT flag
authorJan Kara <jack@suse.cz>
Wed, 9 Nov 2016 23:26:50 +0000 (10:26 +1100)
committerDave Chinner <david@fromorbit.com>
Wed, 9 Nov 2016 23:26:50 +0000 (10:26 +1100)
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>
fs/dax.c
fs/iomap.c
include/linux/iomap.h

index 281e91a6336742499ba39f8410698ffa36673eea..28af41b9da3ac61027beb189f5a8a42f0ca2c69d 100644 (file)
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -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;
        sector_t sector;
        struct iomap iomap = { 0 };
-       unsigned flags = 0;
+       unsigned flags = IOMAP_FAULT;
        int error, major = 0;
        int locked_status = 0;
        void *entry;
@@ -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;
        unsigned long pmd_addr = address & PMD_MASK;
        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;
        int result = VM_FAULT_FALLBACK;
        struct iomap iomap = { 0 };
index 013d1d36fbbf7fa3e3f321a05c8a5e956b731cb6..51a02573405e5b1ccba00d0cdf92b0895881371f 100644 (file)
@@ -468,8 +468,9 @@ int iomap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
 
        offset = page_offset(page);
        while (length > 0) {
-               ret = iomap_apply(inode, offset, length, IOMAP_WRITE,
-                               ops, page, iomap_page_mkwrite_actor);
+               ret = iomap_apply(inode, offset, length,
+                               IOMAP_WRITE | IOMAP_FAULT, ops, page,
+                               iomap_page_mkwrite_actor);
                if (unlikely(ret <= 0))
                        goto out_unlock;
                offset += ret;
index e63e288dee836c5c81d88909550ee1155eb160b2..b9e7b8ec8c1dbb13e67900a3633d0cc596d4dc86 100644 (file)
@@ -44,6 +44,7 @@ struct iomap {
  */
 #define IOMAP_WRITE            (1 << 0)
 #define IOMAP_ZERO             (1 << 1)
+#define IOMAP_FAULT            (1 << 3) /* mapping for page fault */
 
 struct iomap_ops {
        /*