pnfs.h 2.3 KB

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