pnfs.h 2.5 KB

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