Christoph Hellwig | 9cf514c | 2014-05-05 13:11:59 +0200 | [diff] [blame] | 1 | #ifndef _FS_NFSD_PNFS_H |
| 2 | #define _FS_NFSD_PNFS_H 1 |
| 3 | |
J. Bruce Fields | a51f25a | 2015-02-13 12:34:25 -0500 | [diff] [blame] | 4 | #ifdef CONFIG_NFSD_V4 |
Christoph Hellwig | 9cf514c | 2014-05-05 13:11:59 +0200 | [diff] [blame] | 5 | #include <linux/exportfs.h> |
| 6 | #include <linux/nfsd/export.h> |
| 7 | |
| 8 | #include "state.h" |
| 9 | #include "xdr4.h" |
| 10 | |
| 11 | struct xdr_stream; |
| 12 | |
| 13 | struct nfsd4_deviceid_map { |
| 14 | struct list_head hash; |
| 15 | u64 idx; |
| 16 | int fsid_type; |
| 17 | u32 fsid[]; |
| 18 | }; |
| 19 | |
| 20 | struct nfsd4_layout_ops { |
| 21 | u32 notify_types; |
Jeff Layton | 1983a66 | 2016-08-11 13:36:22 -0400 | [diff] [blame] | 22 | bool disable_recalls; |
Christoph Hellwig | 9cf514c | 2014-05-05 13:11:59 +0200 | [diff] [blame] | 23 | |
| 24 | __be32 (*proc_getdeviceinfo)(struct super_block *sb, |
Tom Haynes | d7c920d | 2016-06-14 13:41:27 -0700 | [diff] [blame] | 25 | struct svc_rqst *rqstp, |
Christoph Hellwig | f99d4fb | 2016-03-04 20:46:17 +0100 | [diff] [blame] | 26 | struct nfs4_client *clp, |
Christoph Hellwig | 9cf514c | 2014-05-05 13:11:59 +0200 | [diff] [blame] | 27 | struct nfsd4_getdeviceinfo *gdevp); |
| 28 | __be32 (*encode_getdeviceinfo)(struct xdr_stream *xdr, |
| 29 | struct nfsd4_getdeviceinfo *gdevp); |
| 30 | |
| 31 | __be32 (*proc_layoutget)(struct inode *, const struct svc_fh *fhp, |
| 32 | struct nfsd4_layoutget *lgp); |
| 33 | __be32 (*encode_layoutget)(struct xdr_stream *, |
| 34 | struct nfsd4_layoutget *lgp); |
| 35 | |
| 36 | __be32 (*proc_layoutcommit)(struct inode *inode, |
| 37 | struct nfsd4_layoutcommit *lcp); |
Christoph Hellwig | f99d4fb | 2016-03-04 20:46:17 +0100 | [diff] [blame] | 38 | |
| 39 | void (*fence_client)(struct nfs4_layout_stateid *ls); |
Christoph Hellwig | 9cf514c | 2014-05-05 13:11:59 +0200 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | extern const struct nfsd4_layout_ops *nfsd4_layout_ops[]; |
Christoph Hellwig | 81c3932 | 2016-03-04 20:46:16 +0100 | [diff] [blame] | 43 | #ifdef CONFIG_NFSD_BLOCKLAYOUT |
Christoph Hellwig | 8650b8a | 2015-01-21 11:40:00 +0100 | [diff] [blame] | 44 | extern const struct nfsd4_layout_ops bl_layout_ops; |
Christoph Hellwig | 81c3932 | 2016-03-04 20:46:16 +0100 | [diff] [blame] | 45 | #endif |
Christoph Hellwig | f99d4fb | 2016-03-04 20:46:17 +0100 | [diff] [blame] | 46 | #ifdef CONFIG_NFSD_SCSILAYOUT |
| 47 | extern const struct nfsd4_layout_ops scsi_layout_ops; |
| 48 | #endif |
Tom Haynes | 9b9960a | 2016-06-14 13:41:28 -0700 | [diff] [blame] | 49 | #ifdef CONFIG_NFSD_FLEXFILELAYOUT |
| 50 | extern const struct nfsd4_layout_ops ff_layout_ops; |
| 51 | #endif |
Christoph Hellwig | 9cf514c | 2014-05-05 13:11:59 +0200 | [diff] [blame] | 52 | |
| 53 | __be32 nfsd4_preprocess_layout_stateid(struct svc_rqst *rqstp, |
| 54 | struct nfsd4_compound_state *cstate, stateid_t *stateid, |
| 55 | bool create, u32 layout_type, struct nfs4_layout_stateid **lsp); |
| 56 | __be32 nfsd4_insert_layout(struct nfsd4_layoutget *lgp, |
| 57 | struct nfs4_layout_stateid *ls); |
| 58 | __be32 nfsd4_return_file_layouts(struct svc_rqst *rqstp, |
| 59 | struct nfsd4_compound_state *cstate, |
| 60 | struct nfsd4_layoutreturn *lrp); |
| 61 | __be32 nfsd4_return_client_layouts(struct svc_rqst *rqstp, |
| 62 | struct nfsd4_compound_state *cstate, |
| 63 | struct nfsd4_layoutreturn *lrp); |
| 64 | int nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct svc_fh *fhp, |
| 65 | u32 device_generation); |
| 66 | struct nfsd4_deviceid_map *nfsd4_find_devid_map(int idx); |
J. Bruce Fields | a51f25a | 2015-02-13 12:34:25 -0500 | [diff] [blame] | 67 | #endif /* CONFIG_NFSD_V4 */ |
Christoph Hellwig | 9cf514c | 2014-05-05 13:11:59 +0200 | [diff] [blame] | 68 | |
| 69 | #ifdef CONFIG_NFSD_PNFS |
| 70 | void nfsd4_setup_layout_type(struct svc_export *exp); |
| 71 | void nfsd4_return_all_client_layouts(struct nfs4_client *); |
| 72 | void nfsd4_return_all_file_layouts(struct nfs4_client *clp, |
| 73 | struct nfs4_file *fp); |
| 74 | int nfsd4_init_pnfs(void); |
| 75 | void nfsd4_exit_pnfs(void); |
| 76 | #else |
J. Bruce Fields | a51f25a | 2015-02-13 12:34:25 -0500 | [diff] [blame] | 77 | struct nfs4_client; |
| 78 | struct nfs4_file; |
| 79 | |
Christoph Hellwig | 9cf514c | 2014-05-05 13:11:59 +0200 | [diff] [blame] | 80 | static inline void nfsd4_setup_layout_type(struct svc_export *exp) |
| 81 | { |
| 82 | } |
| 83 | |
| 84 | static inline void nfsd4_return_all_client_layouts(struct nfs4_client *clp) |
| 85 | { |
| 86 | } |
| 87 | static inline void nfsd4_return_all_file_layouts(struct nfs4_client *clp, |
| 88 | struct nfs4_file *fp) |
| 89 | { |
| 90 | } |
| 91 | static inline void nfsd4_exit_pnfs(void) |
| 92 | { |
| 93 | } |
| 94 | static inline int nfsd4_init_pnfs(void) |
| 95 | { |
| 96 | return 0; |
| 97 | } |
| 98 | #endif /* CONFIG_NFSD_PNFS */ |
| 99 | #endif /* _FS_NFSD_PNFS_H */ |