1
0

xfs_zone_alloc.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _XFS_ZONE_ALLOC_H
  3. #define _XFS_ZONE_ALLOC_H
  4. struct iomap_ioend;
  5. struct xfs_open_zone;
  6. struct xfs_zone_alloc_ctx {
  7. struct xfs_open_zone *open_zone;
  8. xfs_filblks_t reserved_blocks;
  9. };
  10. /*
  11. * Grab any available space, even if it is less than what the caller asked for.
  12. */
  13. #define XFS_ZR_GREEDY (1U << 0)
  14. /*
  15. * Only grab instantly available space, don't wait or GC.
  16. */
  17. #define XFS_ZR_NOWAIT (1U << 1)
  18. /*
  19. * Dip into the reserved pool.
  20. */
  21. #define XFS_ZR_RESERVED (1U << 2)
  22. int xfs_zoned_space_reserve(struct xfs_mount *mp, xfs_filblks_t count_fsb,
  23. unsigned int flags, struct xfs_zone_alloc_ctx *ac);
  24. void xfs_zoned_space_unreserve(struct xfs_mount *mp,
  25. struct xfs_zone_alloc_ctx *ac);
  26. void xfs_zoned_add_available(struct xfs_mount *mp, xfs_filblks_t count_fsb);
  27. void xfs_zone_alloc_and_submit(struct iomap_ioend *ioend,
  28. struct xfs_open_zone **oz);
  29. int xfs_zone_free_blocks(struct xfs_trans *tp, struct xfs_rtgroup *rtg,
  30. xfs_fsblock_t fsbno, xfs_filblks_t len);
  31. int xfs_zoned_end_io(struct xfs_inode *ip, xfs_off_t offset, xfs_off_t count,
  32. xfs_daddr_t daddr, struct xfs_open_zone *oz,
  33. xfs_fsblock_t old_startblock);
  34. void xfs_open_zone_put(struct xfs_open_zone *oz);
  35. void xfs_zoned_wake_all(struct xfs_mount *mp);
  36. bool xfs_zone_rgbno_is_valid(struct xfs_rtgroup *rtg, xfs_rgnumber_t rgbno);
  37. void xfs_mark_rtg_boundary(struct iomap_ioend *ioend);
  38. uint64_t xfs_zoned_default_resblks(struct xfs_mount *mp,
  39. enum xfs_free_counter ctr);
  40. void xfs_zoned_show_stats(struct seq_file *m, struct xfs_mount *mp);
  41. #ifdef CONFIG_XFS_RT
  42. int xfs_mount_zones(struct xfs_mount *mp);
  43. void xfs_unmount_zones(struct xfs_mount *mp);
  44. void xfs_zone_gc_start(struct xfs_mount *mp);
  45. void xfs_zone_gc_stop(struct xfs_mount *mp);
  46. #else
  47. static inline int xfs_mount_zones(struct xfs_mount *mp)
  48. {
  49. return -EIO;
  50. }
  51. static inline void xfs_unmount_zones(struct xfs_mount *mp)
  52. {
  53. }
  54. static inline void xfs_zone_gc_start(struct xfs_mount *mp)
  55. {
  56. }
  57. static inline void xfs_zone_gc_stop(struct xfs_mount *mp)
  58. {
  59. }
  60. #endif /* CONFIG_XFS_RT */
  61. #endif /* _XFS_ZONE_ALLOC_H */