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