Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

exportfs: add methods for block layout exports

Add three methods to allow exporting pnfs block layout volumes:

- get_uuid: get a filesystem unique signature exposed to clients
- map_blocks: map and if nessecary allocate blocks for a layout
- commit_blocks: commit blocks in a layout once the client is done with them

For now we stick the external pnfs block layout interfaces into s_export_op to
avoid mixing them up with the internal interface between the NFS server and
the layout drivers. Once we've fully internalized the latter interface we
can redecide if these methods should stay in s_export_ops.

Signed-off-by: Christoph Hellwig <hch@lst.de>

+23
+23
include/linux/exportfs.h
··· 4 4 #include <linux/types.h> 5 5 6 6 struct dentry; 7 + struct iattr; 7 8 struct inode; 8 9 struct super_block; 9 10 struct vfsmount; ··· 181 180 * get_name is not (which is possibly inconsistent) 182 181 */ 183 182 183 + /* types of block ranges for multipage write mappings. */ 184 + #define IOMAP_HOLE 0x01 /* no blocks allocated, need allocation */ 185 + #define IOMAP_DELALLOC 0x02 /* delayed allocation blocks */ 186 + #define IOMAP_MAPPED 0x03 /* blocks allocated @blkno */ 187 + #define IOMAP_UNWRITTEN 0x04 /* blocks allocated @blkno in unwritten state */ 188 + 189 + #define IOMAP_NULL_BLOCK -1LL /* blkno is not valid */ 190 + 191 + struct iomap { 192 + sector_t blkno; /* first sector of mapping */ 193 + loff_t offset; /* file offset of mapping, bytes */ 194 + u64 length; /* length of mapping, bytes */ 195 + int type; /* type of mapping */ 196 + }; 197 + 184 198 struct export_operations { 185 199 int (*encode_fh)(struct inode *inode, __u32 *fh, int *max_len, 186 200 struct inode *parent); ··· 207 191 struct dentry *child); 208 192 struct dentry * (*get_parent)(struct dentry *child); 209 193 int (*commit_metadata)(struct inode *inode); 194 + 195 + int (*get_uuid)(struct super_block *sb, u8 *buf, u32 *len, u64 *offset); 196 + int (*map_blocks)(struct inode *inode, loff_t offset, 197 + u64 len, struct iomap *iomap, 198 + bool write, u32 *device_generation); 199 + int (*commit_blocks)(struct inode *inode, struct iomap *iomaps, 200 + int nr_iomaps, struct iattr *iattr); 210 201 }; 211 202 212 203 extern int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid,