summaryrefslogtreecommitdiff
path: root/fs/f2fs/data.c
diff options
context:
space:
mode:
authorDaeho Jeong <daehojeong@google.com>2022-07-18 16:02:48 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2022-07-30 20:17:07 -0700
commitf8e2f32bcde5945e8f8dbb8714178c24d221366b (patch)
treee9360e5772e2b6bc6d04a4c3c72f85a8f716a62b /fs/f2fs/data.c
parent1adaa71ea9bff3a0ca0b37eabbb7f89225b595cb (diff)
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>
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r--fs/f2fs/data.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index de140afc42c1..b3dbe77f902b 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -3406,12 +3406,11 @@ static int prepare_atomic_write_begin(struct f2fs_sb_info *sbi,
struct inode *cow_inode = F2FS_I(inode)->cow_inode;
pgoff_t index = page->index;
int err = 0;
- block_t ori_blk_addr;
+ block_t ori_blk_addr = NULL_ADDR;
/* If pos is beyond the end of file, reserve a new block in COW inode */
if ((pos & PAGE_MASK) >= i_size_read(inode))
- return __reserve_data_block(cow_inode, index, blk_addr,
- node_changed);
+ goto reserve_block;
/* Look for the block in COW inode first */
err = __find_data_block(cow_inode, index, blk_addr);
@@ -3425,10 +3424,12 @@ static int prepare_atomic_write_begin(struct f2fs_sb_info *sbi,
if (err)
return err;
+reserve_block:
/* Finally, we should reserve a new block in COW inode for the update */
err = __reserve_data_block(cow_inode, index, blk_addr, node_changed);
if (err)
return err;
+ inc_atomic_write_cnt(inode);
if (ori_blk_addr != NULL_ADDR)
*blk_addr = ori_blk_addr;