Merge tag '5.2-smb3' of git://git.samba.org/sfrench/cifs-2.6
[sfrench/cifs-2.6.git] / include / linux / iomap.h
index 0fefb5455bdaf9a0c0167701b7477fc172ee7eca..2103b94cb1bff008e2b3fb47504f068181ae694a 100644 (file)
@@ -53,6 +53,8 @@ struct vm_fault;
  */
 #define IOMAP_NULL_ADDR -1ULL  /* addr is not valid */
 
+struct iomap_page_ops;
+
 struct iomap {
        u64                     addr; /* disk offset of mapping, bytes */
        loff_t                  offset; /* file offset of mapping, bytes */
@@ -63,12 +65,22 @@ struct iomap {
        struct dax_device       *dax_dev; /* dax_dev for dax operations */
        void                    *inline_data;
        void                    *private; /* filesystem private */
+       const struct iomap_page_ops *page_ops;
+};
 
-       /*
-        * Called when finished processing a page in the mapping returned in
-        * this iomap.  At least for now this is only supported in the buffered
-        * write path.
-        */
+/*
+ * When a filesystem sets page_ops in an iomap mapping it returns, page_prepare
+ * and page_done will be called for each page written to.  This only applies to
+ * buffered writes as unbuffered writes will not typically have pages
+ * associated with them.
+ *
+ * When page_prepare succeeds, page_done will always be called to do any
+ * cleanup work necessary.  In that page_done call, @page will be NULL if the
+ * associated page could not be obtained.
+ */
+struct iomap_page_ops {
+       int (*page_prepare)(struct inode *inode, loff_t pos, unsigned len,
+                       struct iomap *iomap);
        void (*page_done)(struct inode *inode, loff_t pos, unsigned copied,
                        struct page *page, struct iomap *iomap);
 };