f2fs: change the current atomic write way
authorDaeho Jeong <daehojeong@google.com>
Thu, 28 Apr 2022 18:18:09 +0000 (11:18 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 12 May 2022 17:14:03 +0000 (10:14 -0700)
commit3db1de0e582c358dd013f3703cd55b5fe4076436
tree230a5fdc8c4699d4b9a5bf7c252d8a2444e5706c
parent6213f5d4d23c50d393a31dc8e351e63a1fd10dbe
f2fs: change the current atomic write way

Current atomic write has three major issues like below.
 - keeps the updates in non-reclaimable memory space and they are even
   hard to be migrated, which is not good for contiguous memory
   allocation.
 - disk spaces used for atomic files cannot be garbage collected, so
   this makes it difficult for the filesystem to be defragmented.
 - If atomic write operations hit the threshold of either memory usage
   or garbage collection failure count, All the atomic write operations
   will fail immediately.

To resolve the issues, I will keep a COW inode internally for all the
updates to be flushed from memory, when we need to flush them out in a
situation like high memory pressure. These COW inodes will be tagged
as orphan inodes to be reclaimed in case of sudden power-cut or system
failure during atomic writes.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
13 files changed:
fs/f2fs/data.c
fs/f2fs/debug.c
fs/f2fs/f2fs.h
fs/f2fs/file.c
fs/f2fs/gc.c
fs/f2fs/inode.c
fs/f2fs/namei.c
fs/f2fs/node.c
fs/f2fs/node.h
fs/f2fs/segment.c
fs/f2fs/segment.h
fs/f2fs/super.c
include/trace/events/f2fs.h