[PATCH RFC 0/3] btrfs: zoned: reclaim block-groups more aggressively

From: Johannes Thumshirn
Date: Thu Mar 28 2024 - 09:56:47 EST


Recently we had reports internally that zoned btrfs can get to -ENOSPC
prematurely, because we're running out of allocatable zones on the drive.

But we would have enough space left, if we would reclaim more aggressively.

The following fio-job is an example how to trigger the failure.

[test]
filename=$SCRATCH_MNT
readwrite=write
ioengine=libaio
direct=1
loops=2
filesize=$60_PERCENT_OF_DRIVE
bs=128k

The reason this is still an RFC is, it is enough to have DATA block groups
free but not METADATA block groups. Of cause the same principle could be
applied to METADATA block groups as well, but I'd prefer to have a
discussion on the general direction first.

---
Johannes Thumshirn (3):
btrfs: zoned: traverse device list in should reclaim under rcu_read_lock
btrfs: zoned: reserve relocation zone on mount
btrfs: zoned: kick cleaner kthread if low on space

fs/btrfs/disk-io.c | 2 ++
fs/btrfs/zoned.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
fs/btrfs/zoned.h | 3 +++
3 files changed, 59 insertions(+), 2 deletions(-)
---
base-commit: c22750cb802ea5fd510fa66f77aefa3a0529951b
change-id: 20240328-hans-2c9e3b4a69e8

Best regards,
--
Johannes Thumshirn <jth@xxxxxxxxxx>