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