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