pnfs.h 2.7 KB

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