| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
#ifndef _LIBXFS_ZONES_H |
| 3 |
#define _LIBXFS_ZONES_H |
| 4 |
|
| 5 |
struct xfs_rtgroup; |
| 6 |
struct blk_zone; |
| 7 |
|
| 8 |
/* |
| 9 |
* In order to guarantee forward progress for GC we need to reserve at least |
| 10 |
* two zones: one that will be used for moving data into and one spare zone |
| 11 |
* making sure that we have enough space to relocate a nearly-full zone. |
| 12 |
* To allow for slightly sloppy accounting for when we need to reserve the |
| 13 |
* second zone, we actually reserve three as that is easier than doing fully |
| 14 |
* accurate bookkeeping. |
| 15 |
*/ |
| 16 |
#define XFS_GC_ZONES 3U |
| 17 |
|
| 18 |
/* |
| 19 |
* In addition we need two zones for user writes, one open zone for writing |
| 20 |
* and one to still have available blocks without resetting the open zone |
| 21 |
* when data in the open zone has been freed. |
| 22 |
*/ |
| 23 |
#define XFS_RESERVED_ZONES (XFS_GC_ZONES + 1) |
| 24 |
#define XFS_MIN_ZONES (XFS_RESERVED_ZONES + 1) |
| 25 |
|
| 26 |
/* |
| 27 |
* Always keep one zone out of the general open zone pool to allow for GC to |
| 28 |
* happen while other writers are waiting for free space. |
| 29 |
*/ |
| 30 |
#define XFS_OPEN_GC_ZONES 1U |
| 31 |
#define XFS_MIN_OPEN_ZONES (XFS_OPEN_GC_ZONES + 1U) |
| 32 |
|
| 33 |
/* |
| 34 |
* For zoned devices that do not have a limit on the number of open zones, and |
| 35 |
* for regular devices using the zoned allocator, use the most common SMR disks |
| 36 |
* limit (128) as the default limit on the number of open zones. |
| 37 |
*/ |
| 38 |
#define XFS_DEFAULT_MAX_OPEN_ZONES 128 |
| 39 |
|
| 40 |
bool xfs_validate_blk_zone(struct xfs_mount *mp, struct blk_zone *zone, |
| 41 |
unsigned int zone_no, uint32_t expected_size, |
| 42 |
uint32_t expected_capacity, xfs_rgblock_t *write_pointer); |
| 43 |
|
| 44 |
#endif /* _LIBXFS_ZONES_H */ |