blob: fedb4d620a81f06492c794790ccba81ad5e7f393 [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[];
Christoph Hellwig8650b8a2015-01-21 11:40:00 +010037extern const struct nfsd4_layout_ops bl_layout_ops;
Christoph Hellwig9cf514c2014-05-05 13:11:59 +020038
39__be32 nfsd4_preprocess_layout_stateid(struct svc_rqst *rqstp,
40 struct nfsd4_compound_state *cstate, stateid_t *stateid,
41 bool create, u32 layout_type, struct nfs4_layout_stateid **lsp);
42__be32 nfsd4_insert_layout(struct nfsd4_layoutget *lgp,
43 struct nfs4_layout_stateid *ls);
44__be32 nfsd4_return_file_layouts(struct svc_rqst *rqstp,
45 struct nfsd4_compound_state *cstate,
46 struct nfsd4_layoutreturn *lrp);
47__be32 nfsd4_return_client_layouts(struct svc_rqst *rqstp,
48 struct nfsd4_compound_state *cstate,
49 struct nfsd4_layoutreturn *lrp);
50int nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct svc_fh *fhp,
51 u32 device_generation);
52struct nfsd4_deviceid_map *nfsd4_find_devid_map(int idx);
53
54#ifdef CONFIG_NFSD_PNFS
55void nfsd4_setup_layout_type(struct svc_export *exp);
56void nfsd4_return_all_client_layouts(struct nfs4_client *);
57void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
58 struct nfs4_file *fp);
59int nfsd4_init_pnfs(void);
60void nfsd4_exit_pnfs(void);
61#else
62static inline void nfsd4_setup_layout_type(struct svc_export *exp)
63{
64}
65
66static inline void nfsd4_return_all_client_layouts(struct nfs4_client *clp)
67{
68}
69static inline void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
70 struct nfs4_file *fp)
71{
72}
73static inline void nfsd4_exit_pnfs(void)
74{
75}
76static inline int nfsd4_init_pnfs(void)
77{
78 return 0;
79}
80#endif /* CONFIG_NFSD_PNFS */
81#endif /* _FS_NFSD_PNFS_H */