blob: d4c4453674c60d5b98120f1209030ba103dbe671 [file] [log] [blame]
Christoph Hellwig9cf514c2014-05-05 13:11:59 +02001#ifndef _FS_NFSD_PNFS_H
2#define _FS_NFSD_PNFS_H 1
3
J. Bruce Fieldsa51f25a2015-02-13 12:34:25 -05004#ifdef CONFIG_NFSD_V4
Christoph Hellwig9cf514c2014-05-05 13:11:59 +02005#include <linux/exportfs.h>
6#include <linux/nfsd/export.h>
7
8#include "state.h"
9#include "xdr4.h"
10
11struct xdr_stream;
12
13struct nfsd4_deviceid_map {
14 struct list_head hash;
15 u64 idx;
16 int fsid_type;
17 u32 fsid[];
18};
19
20struct nfsd4_layout_ops {
21 u32 notify_types;
22
23 __be32 (*proc_getdeviceinfo)(struct super_block *sb,
24 struct nfsd4_getdeviceinfo *gdevp);
25 __be32 (*encode_getdeviceinfo)(struct xdr_stream *xdr,
26 struct nfsd4_getdeviceinfo *gdevp);
27
28 __be32 (*proc_layoutget)(struct inode *, const struct svc_fh *fhp,
29 struct nfsd4_layoutget *lgp);
30 __be32 (*encode_layoutget)(struct xdr_stream *,
31 struct nfsd4_layoutget *lgp);
32
33 __be32 (*proc_layoutcommit)(struct inode *inode,
34 struct nfsd4_layoutcommit *lcp);
35};
36
37extern const struct nfsd4_layout_ops *nfsd4_layout_ops[];
Christoph Hellwig8650b8a2015-01-21 11:40:00 +010038extern const struct nfsd4_layout_ops bl_layout_ops;
Christoph Hellwig9cf514c2014-05-05 13:11:59 +020039
40__be32 nfsd4_preprocess_layout_stateid(struct svc_rqst *rqstp,
41 struct nfsd4_compound_state *cstate, stateid_t *stateid,
42 bool create, u32 layout_type, struct nfs4_layout_stateid **lsp);
43__be32 nfsd4_insert_layout(struct nfsd4_layoutget *lgp,
44 struct nfs4_layout_stateid *ls);
45__be32 nfsd4_return_file_layouts(struct svc_rqst *rqstp,
46 struct nfsd4_compound_state *cstate,
47 struct nfsd4_layoutreturn *lrp);
48__be32 nfsd4_return_client_layouts(struct svc_rqst *rqstp,
49 struct nfsd4_compound_state *cstate,
50 struct nfsd4_layoutreturn *lrp);
51int nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct svc_fh *fhp,
52 u32 device_generation);
53struct nfsd4_deviceid_map *nfsd4_find_devid_map(int idx);
J. Bruce Fieldsa51f25a2015-02-13 12:34:25 -050054#endif /* CONFIG_NFSD_V4 */
Christoph Hellwig9cf514c2014-05-05 13:11:59 +020055
56#ifdef CONFIG_NFSD_PNFS
57void nfsd4_setup_layout_type(struct svc_export *exp);
58void nfsd4_return_all_client_layouts(struct nfs4_client *);
59void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
60 struct nfs4_file *fp);
61int nfsd4_init_pnfs(void);
62void nfsd4_exit_pnfs(void);
63#else
J. Bruce Fieldsa51f25a2015-02-13 12:34:25 -050064struct nfs4_client;
65struct nfs4_file;
66
Christoph Hellwig9cf514c2014-05-05 13:11:59 +020067static inline void nfsd4_setup_layout_type(struct svc_export *exp)
68{
69}
70
71static inline void nfsd4_return_all_client_layouts(struct nfs4_client *clp)
72{
73}
74static inline void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
75 struct nfs4_file *fp)
76{
77}
78static inline void nfsd4_exit_pnfs(void)
79{
80}
81static inline int nfsd4_init_pnfs(void)
82{
83 return 0;
84}
85#endif /* CONFIG_NFSD_PNFS */
86#endif /* _FS_NFSD_PNFS_H */