• Chao Yu's avatar
    f2fs: reduce expensive checkpoint trigger frequency · aaf8c0b9
    Chao Yu authored
    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 bbf156f7 ("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: bbf156f7 ("f2fs: fix lost xattrs of directories")
    Reported-by: default avatarwangzijie <wangzijie1@honor.com>
    Reported-by: default avatarZhiguo Niu <zhiguo.niu@unisoc.com>
    Tested-by: default avatarZhiguo Niu <zhiguo.niu@unisoc.com>
    Reported-by: default avatarYunlei He <heyunlei@hihonor.com>
    Signed-off-by: default avatarChao Yu <chao@kernel.org>
    Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    aaf8c0b9
f2fs.h 58.6 KB