Skip to content

Commit 7fbc106

Browse files
author
Christoph Hellwig
committed
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 <[email protected]>
1 parent 31ef83d commit 7fbc106

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

include/linux/exportfs.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <linux/types.h>
55

66
struct dentry;
7+
struct iattr;
78
struct inode;
89
struct super_block;
910
struct vfsmount;
@@ -180,6 +181,21 @@ struct fid {
180181
* get_name is not (which is possibly inconsistent)
181182
*/
182183

184+
/* types of block ranges for multipage write mappings. */
185+
#define IOMAP_HOLE 0x01 /* no blocks allocated, need allocation */
186+
#define IOMAP_DELALLOC 0x02 /* delayed allocation blocks */
187+
#define IOMAP_MAPPED 0x03 /* blocks allocated @blkno */
188+
#define IOMAP_UNWRITTEN 0x04 /* blocks allocated @blkno in unwritten state */
189+
190+
#define IOMAP_NULL_BLOCK -1LL /* blkno is not valid */
191+
192+
struct iomap {
193+
sector_t blkno; /* first sector of mapping */
194+
loff_t offset; /* file offset of mapping, bytes */
195+
u64 length; /* length of mapping, bytes */
196+
int type; /* type of mapping */
197+
};
198+
183199
struct export_operations {
184200
int (*encode_fh)(struct inode *inode, __u32 *fh, int *max_len,
185201
struct inode *parent);
@@ -191,6 +207,13 @@ struct export_operations {
191207
struct dentry *child);
192208
struct dentry * (*get_parent)(struct dentry *child);
193209
int (*commit_metadata)(struct inode *inode);
210+
211+
int (*get_uuid)(struct super_block *sb, u8 *buf, u32 *len, u64 *offset);
212+
int (*map_blocks)(struct inode *inode, loff_t offset,
213+
u64 len, struct iomap *iomap,
214+
bool write, u32 *device_generation);
215+
int (*commit_blocks)(struct inode *inode, struct iomap *iomaps,
216+
int nr_iomaps, struct iattr *iattr);
194217
};
195218

196219
extern int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid,

0 commit comments

Comments
 (0)