[PATCH 0/5] Support enhanced hot/cold data separation for f2fs

From: qixiaoyu1
Date: Mon Nov 28 2022 - 04:06:21 EST


This patch series introduce a runtime hot/cold data separation
method for f2fs, in order to improve the accuracy for data
temperature classification, reduce the garbage collection overhead
after long-term data updates.

Enhanced hot/cold data separation can record data block update
frequency as "age" of the extent per inode, and take use of the age
info to indicate better temperature type for data block allocation:
- It record total data blocks allocated since mount;
- When file extent has been updated, it calculate the count of data
blocks allocated since last update as the age of the extent;
- Before the data block allocated, it search for the age info and
choose the suitable segment for allocation.

Patch 1 records total data blocks allocated since mount.

Patch 2 implements cache to manager block update frequency per inode.

Patch 3 adds age_extent_cache mount option to enable this feature only
when age_extent_cache mount option is on.

Patch 4 updates block age info during out of place update.

Patch 5 implements data block seperation with block update frequency.

Test and result:
- Prepare: create about 30000 files
* 3% for cold files (with cold file extension like .apk, from 3M to 10M)
* 50% for warm files (with random file extension like .FcDxq, from 1K
to 4M)
* 47% for hot files (with hot file extension like .db, from 1K to 256K)
- create(5%)/random update(90%)/delete(5%) the files
* total write amount is about 70G
* fsync will be called for .db files, and buffered write will be used
for other files

The storage of test device is large enough(128G) so that it will not
switch to SSR mode during the test.

Benefit: dirty segment count increment reduce about 14%
- before: Dirty +21110
- after: Dirty +18286

qixiaoyu1 (2):
f2fs: update block age info during out of place update
f2fs: implement data block seperation with block update frequency

xiongping1 (3):
f2fs: record total data blocks allocated since mount
f2fs: implement cache to manager block update frequency per inode
f2fs: add age_extent_cache mount option

Documentation/ABI/testing/sysfs-fs-f2fs | 14 +
Documentation/filesystems/f2fs.rst | 4 +
fs/f2fs/Kconfig | 7 +
fs/f2fs/Makefile | 1 +
fs/f2fs/block_age.c | 733 ++++++++++++++++++++++++
fs/f2fs/debug.c | 20 +
fs/f2fs/f2fs.h | 83 +++
fs/f2fs/file.c | 10 +
fs/f2fs/inode.c | 8 +
fs/f2fs/namei.c | 4 +
fs/f2fs/node.c | 7 +-
fs/f2fs/node.h | 3 +
fs/f2fs/segment.c | 23 +
fs/f2fs/shrinker.c | 3 +
fs/f2fs/super.c | 51 ++
fs/f2fs/sysfs.c | 28 +
include/trace/events/f2fs.h | 239 ++++++++
17 files changed, 1237 insertions(+), 1 deletion(-)
create mode 100644 fs/f2fs/block_age.c

--
2.36.1