blob: 7d073b9b1553041d32910ef41de7883a90af3b37 [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,
Christoph Hellwigf99d4fb2016-03-04 20:46:17 +010024 struct nfs4_client *clp,
Christoph Hellwig9cf514c2014-05-05 13:11:59 +020025 struct nfsd4_getdeviceinfo *gdevp);
26 __be32 (*encode_getdeviceinfo)(struct xdr_stream *xdr,
27 struct nfsd4_getdeviceinfo *gdevp);
28
29 __be32 (*proc_layoutget)(struct inode *, const struct svc_fh *fhp,
30 struct nfsd4_layoutget *lgp);
31 __be32 (*encode_layoutget)(struct xdr_stream *,
32 struct nfsd4_layoutget *lgp);
33
34 __be32 (*proc_layoutcommit)(struct inode *inode,
35 struct nfsd4_layoutcommit *lcp);
Christoph Hellwigf99d4fb2016-03-04 20:46:17 +010036
37 void (*fence_client)(struct nfs4_layout_stateid *ls);
Christoph Hellwig9cf514c2014-05-05 13:11:59 +020038};
39
40extern const struct nfsd4_layout_ops *nfsd4_layout_ops[];
Christoph Hellwig81c39322016-03-04 20:46:16 +010041#ifdef CONFIG_NFSD_BLOCKLAYOUT
Christoph Hellwig8650b8a2015-01-21 11:40:00 +010042extern const struct nfsd4_layout_ops bl_layout_ops;
Christoph Hellwig81c39322016-03-04 20:46:16 +010043#endif
Christoph Hellwigf99d4fb2016-03-04 20:46:17 +010044#ifdef CONFIG_NFSD_SCSILAYOUT
45extern const struct nfsd4_layout_ops scsi_layout_ops;
46#endif
Christoph Hellwig9cf514c2014-05-05 13:11:59 +020047
48__be32 nfsd4_preprocess_layout_stateid(struct svc_rqst *rqstp,
49 struct nfsd4_compound_state *cstate, stateid_t *stateid,
50 bool create, u32 layout_type, struct nfs4_layout_stateid **lsp);
51__be32 nfsd4_insert_layout(struct nfsd4_layoutget *lgp,
52 struct nfs4_layout_stateid *ls);
53__be32 nfsd4_return_file_layouts(struct svc_rqst *rqstp,
54 struct nfsd4_compound_state *cstate,
55 struct nfsd4_layoutreturn *lrp);
56__be32 nfsd4_return_client_layouts(struct svc_rqst *rqstp,
57 struct nfsd4_compound_state *cstate,
58 struct nfsd4_layoutreturn *lrp);
59int nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct svc_fh *fhp,
60 u32 device_generation);
61struct nfsd4_deviceid_map *nfsd4_find_devid_map(int idx);
J. Bruce Fieldsa51f25a2015-02-13 12:34:25 -050062#endif /* CONFIG_NFSD_V4 */
Christoph Hellwig9cf514c2014-05-05 13:11:59 +020063
64#ifdef CONFIG_NFSD_PNFS
65void nfsd4_setup_layout_type(struct svc_export *exp);
66void nfsd4_return_all_client_layouts(struct nfs4_client *);
67void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
68 struct nfs4_file *fp);
69int nfsd4_init_pnfs(void);
70void nfsd4_exit_pnfs(void);
71#else
J. Bruce Fieldsa51f25a2015-02-13 12:34:25 -050072struct nfs4_client;
73struct nfs4_file;
74
Christoph Hellwig9cf514c2014-05-05 13:11:59 +020075static inline void nfsd4_setup_layout_type(struct svc_export *exp)
76{
77}
78
79static inline void nfsd4_return_all_client_layouts(struct nfs4_client *clp)
80{
81}
82static inline void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
83 struct nfs4_file *fp)
84{
85}
86static inline void nfsd4_exit_pnfs(void)
87{
88}
89static inline int nfsd4_init_pnfs(void)
90{
91 return 0;
92}
93#endif /* CONFIG_NFSD_PNFS */
94#endif /* _FS_NFSD_PNFS_H */