0001
0002 #ifndef _FS_NFSD_PNFS_H
0003 #define _FS_NFSD_PNFS_H 1
0004
0005 #ifdef CONFIG_NFSD_V4
0006 #include <linux/exportfs.h>
0007 #include <linux/nfsd/export.h>
0008
0009 #include "state.h"
0010 #include "xdr4.h"
0011
0012 struct xdr_stream;
0013
0014 struct nfsd4_deviceid_map {
0015 struct list_head hash;
0016 u64 idx;
0017 int fsid_type;
0018 u32 fsid[];
0019 };
0020
0021 struct nfsd4_layout_ops {
0022 u32 notify_types;
0023 bool disable_recalls;
0024
0025 __be32 (*proc_getdeviceinfo)(struct super_block *sb,
0026 struct svc_rqst *rqstp,
0027 struct nfs4_client *clp,
0028 struct nfsd4_getdeviceinfo *gdevp);
0029 __be32 (*encode_getdeviceinfo)(struct xdr_stream *xdr,
0030 struct nfsd4_getdeviceinfo *gdevp);
0031
0032 __be32 (*proc_layoutget)(struct inode *, const struct svc_fh *fhp,
0033 struct nfsd4_layoutget *lgp);
0034 __be32 (*encode_layoutget)(struct xdr_stream *,
0035 struct nfsd4_layoutget *lgp);
0036
0037 __be32 (*proc_layoutcommit)(struct inode *inode,
0038 struct nfsd4_layoutcommit *lcp);
0039
0040 void (*fence_client)(struct nfs4_layout_stateid *ls);
0041 };
0042
0043 extern const struct nfsd4_layout_ops *nfsd4_layout_ops[];
0044 #ifdef CONFIG_NFSD_BLOCKLAYOUT
0045 extern const struct nfsd4_layout_ops bl_layout_ops;
0046 #endif
0047 #ifdef CONFIG_NFSD_SCSILAYOUT
0048 extern const struct nfsd4_layout_ops scsi_layout_ops;
0049 #endif
0050 #ifdef CONFIG_NFSD_FLEXFILELAYOUT
0051 extern const struct nfsd4_layout_ops ff_layout_ops;
0052 #endif
0053
0054 __be32 nfsd4_preprocess_layout_stateid(struct svc_rqst *rqstp,
0055 struct nfsd4_compound_state *cstate, stateid_t *stateid,
0056 bool create, u32 layout_type, struct nfs4_layout_stateid **lsp);
0057 __be32 nfsd4_insert_layout(struct nfsd4_layoutget *lgp,
0058 struct nfs4_layout_stateid *ls);
0059 __be32 nfsd4_return_file_layouts(struct svc_rqst *rqstp,
0060 struct nfsd4_compound_state *cstate,
0061 struct nfsd4_layoutreturn *lrp);
0062 __be32 nfsd4_return_client_layouts(struct svc_rqst *rqstp,
0063 struct nfsd4_compound_state *cstate,
0064 struct nfsd4_layoutreturn *lrp);
0065 int nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct svc_fh *fhp,
0066 u32 device_generation);
0067 struct nfsd4_deviceid_map *nfsd4_find_devid_map(int idx);
0068 #endif
0069
0070 #ifdef CONFIG_NFSD_PNFS
0071 void nfsd4_setup_layout_type(struct svc_export *exp);
0072 void nfsd4_return_all_client_layouts(struct nfs4_client *);
0073 void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
0074 struct nfs4_file *fp);
0075 int nfsd4_init_pnfs(void);
0076 void nfsd4_exit_pnfs(void);
0077 #else
0078 struct nfs4_client;
0079 struct nfs4_file;
0080
0081 static inline void nfsd4_setup_layout_type(struct svc_export *exp)
0082 {
0083 }
0084
0085 static inline void nfsd4_return_all_client_layouts(struct nfs4_client *clp)
0086 {
0087 }
0088 static inline void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
0089 struct nfs4_file *fp)
0090 {
0091 }
0092 static inline void nfsd4_exit_pnfs(void)
0093 {
0094 }
0095 static inline int nfsd4_init_pnfs(void)
0096 {
0097 return 0;
0098 }
0099 #endif
0100 #endif