]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/linux/iomap.h
Merge tag 'f2fs-for-5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs
[linux.git] / include / linux / iomap.h
index 6e00bb843c7f50e2eb62815e4aae86c048c01302..8b09463dae0dba2a4a60ce2372863ba0e8fd16b9 100644 (file)
@@ -23,30 +23,45 @@ struct vm_fault;
 /*
  * Types of block ranges for iomap mappings:
  */
-#define IOMAP_HOLE     0x01    /* no blocks allocated, need allocation */
-#define IOMAP_DELALLOC 0x02    /* delayed allocation blocks */
-#define IOMAP_MAPPED   0x03    /* blocks allocated at @addr */
-#define IOMAP_UNWRITTEN        0x04    /* blocks allocated at @addr in unwritten state */
-#define IOMAP_INLINE   0x05    /* data inline in the inode */
+#define IOMAP_HOLE     0       /* no blocks allocated, need allocation */
+#define IOMAP_DELALLOC 1       /* delayed allocation blocks */
+#define IOMAP_MAPPED   2       /* blocks allocated at @addr */
+#define IOMAP_UNWRITTEN        3       /* blocks allocated at @addr in unwritten state */
+#define IOMAP_INLINE   4       /* data inline in the inode */
 
 /*
- * Flags for all iomap mappings:
+ * Flags reported by the file system from iomap_begin:
+ *
+ * IOMAP_F_NEW indicates that the blocks have been newly allocated and need
+ * zeroing for areas that no data is copied to.
  *
  * IOMAP_F_DIRTY indicates the inode has uncommitted metadata needed to access
  * written data and requires fdatasync to commit them to persistent storage.
  * This needs to take into account metadata changes that *may* be made at IO
  * completion, such as file size updates from direct IO.
+ *
+ * IOMAP_F_SHARED indicates that the blocks are shared, and will need to be
+ * unshared as part a write.
+ *
+ * IOMAP_F_MERGED indicates that the iomap contains the merge of multiple block
+ * mappings.
+ *
+ * IOMAP_F_BUFFER_HEAD indicates that the file system requires the use of
+ * buffer heads for this mapping.
  */
-#define IOMAP_F_NEW            0x01    /* blocks have been newly allocated */
-#define IOMAP_F_DIRTY          0x02    /* uncommitted metadata */
-#define IOMAP_F_BUFFER_HEAD    0x04    /* file system requires buffer heads */
-#define IOMAP_F_SIZE_CHANGED   0x08    /* file size has changed */
+#define IOMAP_F_NEW            0x01
+#define IOMAP_F_DIRTY          0x02
+#define IOMAP_F_SHARED         0x04
+#define IOMAP_F_MERGED         0x08
+#define IOMAP_F_BUFFER_HEAD    0x10
 
 /*
- * Flags that only need to be reported for IOMAP_REPORT requests:
+ * Flags set by the core iomap code during operations:
+ *
+ * IOMAP_F_SIZE_CHANGED indicates to the iomap_end method that the file size
+ * has changed as the result of this write operation.
  */
-#define IOMAP_F_MERGED         0x10    /* contains multiple blocks/extents */
-#define IOMAP_F_SHARED         0x20    /* block shared with another file */
+#define IOMAP_F_SIZE_CHANGED   0x100
 
 /*
  * Flags from 0x1000 up are for file system specific usage:
@@ -114,7 +129,8 @@ struct iomap_ops {
         * The actual length is returned in iomap->length.
         */
        int (*iomap_begin)(struct inode *inode, loff_t pos, loff_t length,
-                       unsigned flags, struct iomap *iomap);
+                       unsigned flags, struct iomap *iomap,
+                       struct iomap *srcmap);
 
        /*
         * Commit and/or unreserve space previous allocated using iomap_begin.
@@ -130,29 +146,12 @@ struct iomap_ops {
  * Main iomap iterator function.
  */
 typedef loff_t (*iomap_actor_t)(struct inode *inode, loff_t pos, loff_t len,
-               void *data, struct iomap *iomap);
+               void *data, struct iomap *iomap, struct iomap *srcmap);
 
 loff_t iomap_apply(struct inode *inode, loff_t pos, loff_t length,
                unsigned flags, const struct iomap_ops *ops, void *data,
                iomap_actor_t actor);
 
-/*
- * Structure allocate for each page when block size < PAGE_SIZE to track
- * sub-page uptodate status and I/O completions.
- */
-struct iomap_page {
-       atomic_t                read_count;
-       atomic_t                write_count;
-       DECLARE_BITMAP(uptodate, PAGE_SIZE / 512);
-};
-
-static inline struct iomap_page *to_iomap_page(struct page *page)
-{
-       if (page_has_private(page))
-               return (struct iomap_page *)page_private(page);
-       return NULL;
-}
-
 ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from,
                const struct iomap_ops *ops);
 int iomap_readpage(struct page *page, const struct iomap_ops *ops);
@@ -170,7 +169,7 @@ int iomap_migrate_page(struct address_space *mapping, struct page *newpage,
 #else
 #define iomap_migrate_page NULL
 #endif
-int iomap_file_dirty(struct inode *inode, loff_t pos, loff_t len,
+int iomap_file_unshare(struct inode *inode, loff_t pos, loff_t len,
                const struct iomap_ops *ops);
 int iomap_zero_range(struct inode *inode, loff_t pos, loff_t len,
                bool *did_zero, const struct iomap_ops *ops);