]> www.infradead.org Git - users/jedix/linux-maple.git/commit
f2fs: reduce expensive checkpoint trigger frequency
authorChao Yu <chao@kernel.org>
Wed, 26 Jun 2024 01:47:27 +0000 (09:47 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 15 Aug 2024 15:26:39 +0000 (15:26 +0000)
commitaaf8c0b9ae042494cb4585883b15c1332de77840
tree01021ca2cf9b0ad69138123e301a68c00df5b6ba
parent1a0bd289a5db1df8df8fab949633a0b8d3f235ee
f2fs: reduce expensive checkpoint trigger frequency

We may trigger high frequent checkpoint for below case:
1. mkdir /mnt/dir1; set dir1 encrypted
2. touch /mnt/file1; fsync /mnt/file1
3. mkdir /mnt/dir2; set dir2 encrypted
4. touch /mnt/file2; fsync /mnt/file2
...

Although, newly created dir and file are not related, due to
commit bbf156f7afa7 ("f2fs: fix lost xattrs of directories"), we will
trigger checkpoint whenever fsync() comes after a new encrypted dir
created.

In order to avoid such performance regression issue, let's record an
entry including directory's ino in global cache whenever we update
directory's xattr data, and then triggerring checkpoint() only if
xattr metadata of target file's parent was updated.

This patch updates to cover below no encryption case as well:
1) parent is checkpointed
2) set_xattr(dir) w/ new xnid
3) create(file)
4) fsync(file)

Fixes: bbf156f7afa7 ("f2fs: fix lost xattrs of directories")
Reported-by: wangzijie <wangzijie1@honor.com>
Reported-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
Tested-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
Reported-by: Yunlei He <heyunlei@hihonor.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/f2fs.h
fs/f2fs/file.c
fs/f2fs/xattr.c
include/trace/events/f2fs.h