xfs: support write life time based data placement
authorHans Holmberg <hans.holmberg@wdc.com>
Fri, 31 Jan 2025 08:39:36 +0000 (09:39 +0100)
committerChristoph Hellwig <hch@lst.de>
Mon, 3 Mar 2025 15:17:10 +0000 (08:17 -0700)
commit64d0361114fdeae992da2a6c409041c3c13b63ae
treed7b2b55189ae6a6a6ec5fdc139dd653d4044d792
parent7452a6daf9f9c343d483cff60a0016379c1edb6c
xfs: support write life time based data placement

Add a file write life time data placement allocation scheme that aims to
minimize fragmentation and thereby to do two things:

 a) separate file data to different zones when possible.
 b) colocate file data of similar life times when feasible.

To get best results, average file sizes should align with the zone
capacity that is reported through the XFS_IOC_FSGEOMETRY ioctl.

This improvement in data placement efficiency reduces the number of
blocks requiring relocation by GC, and thus decreases overall write
amplification.  The impact on performance varies depending on how full
the file system is.

For RocksDB using leveled compaction, the lifetime hints can improve
throughput for overwrite workloads at 80% file system utilization by
~10%, but for lower file system utilization there won't be as much
benefit in application performance as there is less need for garbage
collection to start with.

Lifetime hints can be disabled using the nolifetime mount option.

Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
fs/xfs/xfs_mount.h
fs/xfs/xfs_super.c
fs/xfs/xfs_zone_alloc.c
fs/xfs/xfs_zone_gc.c
fs/xfs/xfs_zone_priv.h