xref: /openbmc/linux/fs/nfsd/pnfs.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
29cf514ccSChristoph Hellwig #ifndef _FS_NFSD_PNFS_H
39cf514ccSChristoph Hellwig #define _FS_NFSD_PNFS_H 1
49cf514ccSChristoph Hellwig 
5a51f25a5SJ. Bruce Fields #ifdef CONFIG_NFSD_V4
69cf514ccSChristoph Hellwig #include <linux/exportfs.h>
79cf514ccSChristoph Hellwig #include <linux/nfsd/export.h>
89cf514ccSChristoph Hellwig 
99cf514ccSChristoph Hellwig #include "state.h"
109cf514ccSChristoph Hellwig #include "xdr4.h"
119cf514ccSChristoph Hellwig 
129cf514ccSChristoph Hellwig struct xdr_stream;
139cf514ccSChristoph Hellwig 
149cf514ccSChristoph Hellwig struct nfsd4_deviceid_map {
159cf514ccSChristoph Hellwig 	struct list_head	hash;
169cf514ccSChristoph Hellwig 	u64			idx;
179cf514ccSChristoph Hellwig 	int			fsid_type;
189cf514ccSChristoph Hellwig 	u32			fsid[];
199cf514ccSChristoph Hellwig };
209cf514ccSChristoph Hellwig 
219cf514ccSChristoph Hellwig struct nfsd4_layout_ops {
229cf514ccSChristoph Hellwig 	u32		notify_types;
231983a66fSJeff Layton 	bool		disable_recalls;
249cf514ccSChristoph Hellwig 
259cf514ccSChristoph Hellwig 	__be32 (*proc_getdeviceinfo)(struct super_block *sb,
26d7c920d1STom Haynes 			struct svc_rqst *rqstp,
27f99d4fbdSChristoph Hellwig 			struct nfs4_client *clp,
289cf514ccSChristoph Hellwig 			struct nfsd4_getdeviceinfo *gdevp);
299cf514ccSChristoph Hellwig 	__be32 (*encode_getdeviceinfo)(struct xdr_stream *xdr,
309cf514ccSChristoph Hellwig 			struct nfsd4_getdeviceinfo *gdevp);
319cf514ccSChristoph Hellwig 
329cf514ccSChristoph Hellwig 	__be32 (*proc_layoutget)(struct inode *, const struct svc_fh *fhp,
339cf514ccSChristoph Hellwig 			struct nfsd4_layoutget *lgp);
349cf514ccSChristoph Hellwig 	__be32 (*encode_layoutget)(struct xdr_stream *,
359cf514ccSChristoph Hellwig 			struct nfsd4_layoutget *lgp);
369cf514ccSChristoph Hellwig 
379cf514ccSChristoph Hellwig 	__be32 (*proc_layoutcommit)(struct inode *inode,
389cf514ccSChristoph Hellwig 			struct nfsd4_layoutcommit *lcp);
39f99d4fbdSChristoph Hellwig 
40f99d4fbdSChristoph Hellwig 	void (*fence_client)(struct nfs4_layout_stateid *ls);
419cf514ccSChristoph Hellwig };
429cf514ccSChristoph Hellwig 
439cf514ccSChristoph Hellwig extern const struct nfsd4_layout_ops *nfsd4_layout_ops[];
4481c39329SChristoph Hellwig #ifdef CONFIG_NFSD_BLOCKLAYOUT
458650b8a0SChristoph Hellwig extern const struct nfsd4_layout_ops bl_layout_ops;
4681c39329SChristoph Hellwig #endif
47f99d4fbdSChristoph Hellwig #ifdef CONFIG_NFSD_SCSILAYOUT
48f99d4fbdSChristoph Hellwig extern const struct nfsd4_layout_ops scsi_layout_ops;
49f99d4fbdSChristoph Hellwig #endif
509b9960a0STom Haynes #ifdef CONFIG_NFSD_FLEXFILELAYOUT
519b9960a0STom Haynes extern const struct nfsd4_layout_ops ff_layout_ops;
529b9960a0STom Haynes #endif
539cf514ccSChristoph Hellwig 
549cf514ccSChristoph Hellwig __be32 nfsd4_preprocess_layout_stateid(struct svc_rqst *rqstp,
559cf514ccSChristoph Hellwig 		struct nfsd4_compound_state *cstate, stateid_t *stateid,
569cf514ccSChristoph Hellwig 		bool create, u32 layout_type, struct nfs4_layout_stateid **lsp);
579cf514ccSChristoph Hellwig __be32 nfsd4_insert_layout(struct nfsd4_layoutget *lgp,
589cf514ccSChristoph Hellwig 		struct nfs4_layout_stateid *ls);
599cf514ccSChristoph Hellwig __be32 nfsd4_return_file_layouts(struct svc_rqst *rqstp,
609cf514ccSChristoph Hellwig 		struct nfsd4_compound_state *cstate,
619cf514ccSChristoph Hellwig 		struct nfsd4_layoutreturn *lrp);
629cf514ccSChristoph Hellwig __be32 nfsd4_return_client_layouts(struct svc_rqst *rqstp,
639cf514ccSChristoph Hellwig 		struct nfsd4_compound_state *cstate,
649cf514ccSChristoph Hellwig 		struct nfsd4_layoutreturn *lrp);
659cf514ccSChristoph Hellwig int nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct svc_fh *fhp,
669cf514ccSChristoph Hellwig 		u32 device_generation);
679cf514ccSChristoph Hellwig struct nfsd4_deviceid_map *nfsd4_find_devid_map(int idx);
68a51f25a5SJ. Bruce Fields #endif /* CONFIG_NFSD_V4 */
699cf514ccSChristoph Hellwig 
709cf514ccSChristoph Hellwig #ifdef CONFIG_NFSD_PNFS
719cf514ccSChristoph Hellwig void nfsd4_setup_layout_type(struct svc_export *exp);
729cf514ccSChristoph Hellwig void nfsd4_return_all_client_layouts(struct nfs4_client *);
739cf514ccSChristoph Hellwig void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
749cf514ccSChristoph Hellwig 		struct nfs4_file *fp);
759cf514ccSChristoph Hellwig int nfsd4_init_pnfs(void);
769cf514ccSChristoph Hellwig void nfsd4_exit_pnfs(void);
779cf514ccSChristoph Hellwig #else
78a51f25a5SJ. Bruce Fields struct nfs4_client;
79a51f25a5SJ. Bruce Fields struct nfs4_file;
80a51f25a5SJ. Bruce Fields 
nfsd4_setup_layout_type(struct svc_export * exp)819cf514ccSChristoph Hellwig static inline void nfsd4_setup_layout_type(struct svc_export *exp)
829cf514ccSChristoph Hellwig {
839cf514ccSChristoph Hellwig }
849cf514ccSChristoph Hellwig 
nfsd4_return_all_client_layouts(struct nfs4_client * clp)859cf514ccSChristoph Hellwig static inline void nfsd4_return_all_client_layouts(struct nfs4_client *clp)
869cf514ccSChristoph Hellwig {
879cf514ccSChristoph Hellwig }
nfsd4_return_all_file_layouts(struct nfs4_client * clp,struct nfs4_file * fp)889cf514ccSChristoph Hellwig static inline void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
899cf514ccSChristoph Hellwig 		struct nfs4_file *fp)
909cf514ccSChristoph Hellwig {
919cf514ccSChristoph Hellwig }
nfsd4_exit_pnfs(void)929cf514ccSChristoph Hellwig static inline void nfsd4_exit_pnfs(void)
939cf514ccSChristoph Hellwig {
949cf514ccSChristoph Hellwig }
nfsd4_init_pnfs(void)959cf514ccSChristoph Hellwig static inline int nfsd4_init_pnfs(void)
969cf514ccSChristoph Hellwig {
979cf514ccSChristoph Hellwig 	return 0;
989cf514ccSChristoph Hellwig }
999cf514ccSChristoph Hellwig #endif /* CONFIG_NFSD_PNFS */
1009cf514ccSChristoph Hellwig #endif /* _FS_NFSD_PNFS_H */
101