f2fs: introduce sysfs atomic write statistics

introduce the below 4 new sysfs node for atomic write statistics.
- current_atomic_write: the total current atomic write block count,
                        which is not committed yet.
- peak_atomic_write: the peak value of total current atomic write block
                     count after boot.
- committed_atomic_block: the accumulated total committed atomic write
                          block count after boot.
- revoked_atomic_block: the accumulated total revoked atomic write block
                        count after boot.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Daeho Jeong
2022-07-18 16:02:48 -07:00
committed by Jaegeuk Kim
parent 9b761b6413
commit 637ed34c41
7 changed files with 112 additions and 3 deletions

View File

@@ -195,6 +195,7 @@ void f2fs_abort_atomic_write(struct inode *inode, bool clean)
clear_inode_flag(fi->cow_inode, FI_ATOMIC_FILE);
iput(fi->cow_inode);
fi->cow_inode = NULL;
release_atomic_write_cnt(inode);
clear_inode_flag(inode, FI_ATOMIC_FILE);
spin_lock(&sbi->inode_lock[ATOMIC_FILE]);
@@ -334,6 +335,11 @@ next:
}
out:
if (ret)
sbi->revoked_atomic_block += fi->atomic_write_cnt;
else
sbi->committed_atomic_block += fi->atomic_write_cnt;
__complete_revoke_list(inode, &revoke_list, ret ? true : false);
return ret;