exportfs: add methods for block layout exports
[firefly-linux-kernel-4.4.55.git] / include / linux / exportfs.h
index 41b223a59a636c5aa2b1dfa5e4e9cf829f31bff2..fa05e04c5531ce7ae8195abcb0b03b7343e40037 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/types.h>
 
 struct dentry;
+struct iattr;
 struct inode;
 struct super_block;
 struct vfsmount;
@@ -180,6 +181,21 @@ struct fid {
  *    get_name is not (which is possibly inconsistent)
  */
 
+/* types of block ranges for multipage write mappings. */
+#define IOMAP_HOLE     0x01    /* no blocks allocated, need allocation */
+#define IOMAP_DELALLOC 0x02    /* delayed allocation blocks */
+#define IOMAP_MAPPED   0x03    /* blocks allocated @blkno */
+#define IOMAP_UNWRITTEN        0x04    /* blocks allocated @blkno in unwritten state */
+
+#define IOMAP_NULL_BLOCK -1LL  /* blkno is not valid */
+
+struct iomap {
+       sector_t        blkno;  /* first sector of mapping */
+       loff_t          offset; /* file offset of mapping, bytes */
+       u64             length; /* length of mapping, bytes */
+       int             type;   /* type of mapping */
+};
+
 struct export_operations {
        int (*encode_fh)(struct inode *inode, __u32 *fh, int *max_len,
                        struct inode *parent);
@@ -191,6 +207,13 @@ struct export_operations {
                        struct dentry *child);
        struct dentry * (*get_parent)(struct dentry *child);
        int (*commit_metadata)(struct inode *inode);
+
+       int (*get_uuid)(struct super_block *sb, u8 *buf, u32 *len, u64 *offset);
+       int (*map_blocks)(struct inode *inode, loff_t offset,
+                         u64 len, struct iomap *iomap,
+                         bool write, u32 *device_generation);
+       int (*commit_blocks)(struct inode *inode, struct iomap *iomaps,
+                            int nr_iomaps, struct iattr *iattr);
 };
 
 extern int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid,