1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LIBXFS_ZONES_H
3 #define _LIBXFS_ZONES_H
4 
5 struct xfs_rtgroup;
6 
7 /*
8  * In order to guarantee forward progress for GC we need to reserve at least
9  * two zones:  one that will be used for moving data into and one spare zone
10  * making sure that we have enough space to relocate a nearly-full zone.
11  * To allow for slightly sloppy accounting for when we need to reserve the
12  * second zone, we actually reserve three as that is easier than doing fully
13  * accurate bookkeeping.
14  */
15 #define XFS_GC_ZONES		3U
16 
17 /*
18  * In addition we need two zones for user writes, one open zone for writing
19  * and one to still have available blocks without resetting the open zone
20  * when data in the open zone has been freed.
21  */
22 #define XFS_RESERVED_ZONES	(XFS_GC_ZONES + 1)
23 #define XFS_MIN_ZONES		(XFS_RESERVED_ZONES + 1)
24 
25 /*
26  * Always keep one zone out of the general open zone pool to allow for GC to
27  * happen while other writers are waiting for free space.
28  */
29 #define XFS_OPEN_GC_ZONES	1U
30 #define XFS_MIN_OPEN_ZONES	(XFS_OPEN_GC_ZONES + 1U)
31 
32 bool xfs_zone_validate(struct blk_zone *zone, struct xfs_rtgroup *rtg,
33 	xfs_rgblock_t *write_pointer);
34 
35 #endif /* _LIBXFS_ZONES_H */
36