pnfs.h 2.9 KB

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