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