blob: 0c2a716e87411d6b08258632e966666f34190b82 [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,
Tom Haynesd7c920d2016-06-14 13:41:27 -070024 struct svc_rqst *rqstp,
Christoph Hellwigf99d4fb2016-03-04 20:46:17 +010025 struct nfs4_client *clp,
Christoph Hellwig9cf514c2014-05-05 13:11:59 +020026 struct nfsd4_getdeviceinfo *gdevp);
27 __be32 (*encode_getdeviceinfo)(struct xdr_stream *xdr,
28 struct nfsd4_getdeviceinfo *gdevp);
29
30 __be32 (*proc_layoutget)(struct inode *, const struct svc_fh *fhp,
31 struct nfsd4_layoutget *lgp);
32 __be32 (*encode_layoutget)(struct xdr_stream *,
33 struct nfsd4_layoutget *lgp);
34
35 __be32 (*proc_layoutcommit)(struct inode *inode,
36 struct nfsd4_layoutcommit *lcp);
Christoph Hellwigf99d4fb2016-03-04 20:46:17 +010037
38 void (*fence_client)(struct nfs4_layout_stateid *ls);
Christoph Hellwig9cf514c2014-05-05 13:11:59 +020039};
40
41extern const struct nfsd4_layout_ops *nfsd4_layout_ops[];
Christoph Hellwig81c39322016-03-04 20:46:16 +010042#ifdef CONFIG_NFSD_BLOCKLAYOUT
Christoph Hellwig8650b8a2015-01-21 11:40:00 +010043extern const struct nfsd4_layout_ops bl_layout_ops;
Christoph Hellwig81c39322016-03-04 20:46:16 +010044#endif
Christoph Hellwigf99d4fb2016-03-04 20:46:17 +010045#ifdef CONFIG_NFSD_SCSILAYOUT
46extern const struct nfsd4_layout_ops scsi_layout_ops;
47#endif
Tom Haynes9b9960a2016-06-14 13:41:28 -070048#ifdef CONFIG_NFSD_FLEXFILELAYOUT
49extern const struct nfsd4_layout_ops ff_layout_ops;
50#endif
Christoph Hellwig9cf514c2014-05-05 13:11:59 +020051
52__be32 nfsd4_preprocess_layout_stateid(struct svc_rqst *rqstp,
53 struct nfsd4_compound_state *cstate, stateid_t *stateid,
54 bool create, u32 layout_type, struct nfs4_layout_stateid **lsp);
55__be32 nfsd4_insert_layout(struct nfsd4_layoutget *lgp,
56 struct nfs4_layout_stateid *ls);
57__be32 nfsd4_return_file_layouts(struct svc_rqst *rqstp,
58 struct nfsd4_compound_state *cstate,
59 struct nfsd4_layoutreturn *lrp);
60__be32 nfsd4_return_client_layouts(struct svc_rqst *rqstp,
61 struct nfsd4_compound_state *cstate,
62 struct nfsd4_layoutreturn *lrp);
63int nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct svc_fh *fhp,
64 u32 device_generation);
65struct nfsd4_deviceid_map *nfsd4_find_devid_map(int idx);
J. Bruce Fieldsa51f25a2015-02-13 12:34:25 -050066#endif /* CONFIG_NFSD_V4 */
Christoph Hellwig9cf514c2014-05-05 13:11:59 +020067
68#ifdef CONFIG_NFSD_PNFS
69void nfsd4_setup_layout_type(struct svc_export *exp);
70void nfsd4_return_all_client_layouts(struct nfs4_client *);
71void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
72 struct nfs4_file *fp);
73int nfsd4_init_pnfs(void);
74void nfsd4_exit_pnfs(void);
75#else
J. Bruce Fieldsa51f25a2015-02-13 12:34:25 -050076struct nfs4_client;
77struct nfs4_file;
78
Christoph Hellwig9cf514c2014-05-05 13:11:59 +020079static inline void nfsd4_setup_layout_type(struct svc_export *exp)
80{
81}
82
83static inline void nfsd4_return_all_client_layouts(struct nfs4_client *clp)
84{
85}
86static inline void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
87 struct nfs4_file *fp)
88{
89}
90static inline void nfsd4_exit_pnfs(void)
91{
92}
93static inline int nfsd4_init_pnfs(void)
94{
95 return 0;
96}
97#endif /* CONFIG_NFSD_PNFS */
98#endif /* _FS_NFSD_PNFS_H */