pnfs.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. 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 *,
  28. struct nfsd4_layoutget *lgp);
  29. __be32 (*proc_layoutcommit)(struct inode *inode,
  30. struct nfsd4_layoutcommit *lcp);
  31. void (*fence_client)(struct nfs4_layout_stateid *ls);
  32. };
  33. extern const struct nfsd4_layout_ops *nfsd4_layout_ops[];
  34. #ifdef CONFIG_NFSD_BLOCKLAYOUT
  35. extern const struct nfsd4_layout_ops bl_layout_ops;
  36. #endif
  37. #ifdef CONFIG_NFSD_SCSILAYOUT
  38. extern const struct nfsd4_layout_ops scsi_layout_ops;
  39. #endif
  40. #ifdef CONFIG_NFSD_FLEXFILELAYOUT
  41. extern const struct nfsd4_layout_ops ff_layout_ops;
  42. #endif
  43. __be32 nfsd4_preprocess_layout_stateid(struct svc_rqst *rqstp,
  44. struct nfsd4_compound_state *cstate, stateid_t *stateid,
  45. bool create, u32 layout_type, struct nfs4_layout_stateid **lsp);
  46. __be32 nfsd4_insert_layout(struct nfsd4_layoutget *lgp,
  47. struct nfs4_layout_stateid *ls);
  48. __be32 nfsd4_return_file_layouts(struct svc_rqst *rqstp,
  49. struct nfsd4_compound_state *cstate,
  50. struct nfsd4_layoutreturn *lrp);
  51. __be32 nfsd4_return_client_layouts(struct svc_rqst *rqstp,
  52. struct nfsd4_compound_state *cstate,
  53. struct nfsd4_layoutreturn *lrp);
  54. int nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct svc_fh *fhp,
  55. u32 device_generation);
  56. struct nfsd4_deviceid_map *nfsd4_find_devid_map(int idx);
  57. #endif /* CONFIG_NFSD_V4 */
  58. #ifdef CONFIG_NFSD_PNFS
  59. void nfsd4_setup_layout_type(struct svc_export *exp);
  60. void nfsd4_return_all_client_layouts(struct nfs4_client *);
  61. void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
  62. struct nfs4_file *fp);
  63. int nfsd4_init_pnfs(void);
  64. void nfsd4_exit_pnfs(void);
  65. #else
  66. struct nfs4_client;
  67. struct nfs4_file;
  68. static inline void nfsd4_setup_layout_type(struct svc_export *exp)
  69. {
  70. }
  71. static inline void nfsd4_return_all_client_layouts(struct nfs4_client *clp)
  72. {
  73. }
  74. static inline void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
  75. struct nfs4_file *fp)
  76. {
  77. }
  78. static inline void nfsd4_exit_pnfs(void)
  79. {
  80. }
  81. static inline int nfsd4_init_pnfs(void)
  82. {
  83. return 0;
  84. }
  85. #endif /* CONFIG_NFSD_PNFS */
  86. #endif /* _FS_NFSD_PNFS_H */