summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-01-19 07:36:18 +0100
committerJaegeuk Kim <jaegeuk@kernel.org>2023-01-31 19:49:30 +0100
commit2163a691c5f3d30326ff09193c97aec47cec9eba (patch)
tree0671059239a5da5ccc5f0a2dcc3138d0c06bb6ff /fs/f2fs
parentf2fs: fix to abort atomic write only during do_exist() (diff)
downloadlinux-2163a691c5f3d30326ff09193c97aec47cec9eba.tar.xz
linux-2163a691c5f3d30326ff09193c97aec47cec9eba.zip
f2fs: remove __add_sum_entry
This function just assigns a summary entry. This can be done entirely typesafe with an open code struct assignment that relies on array indexing. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/segment.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 95a5e6ef7e80..39071003c6d7 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2340,19 +2340,6 @@ bool f2fs_is_checkpointed_data(struct f2fs_sb_info *sbi, block_t blkaddr)
}
/*
- * This function should be resided under the curseg_mutex lock
- */
-static void __add_sum_entry(struct f2fs_sb_info *sbi, int type,
- struct f2fs_summary *sum)
-{
- struct curseg_info *curseg = CURSEG_I(sbi, type);
- void *addr = curseg->sum_blk;
-
- addr += curseg->next_blkoff * sizeof(struct f2fs_summary);
- memcpy(addr, sum, sizeof(struct f2fs_summary));
-}
-
-/*
* Calculate the number of current summary pages for writing
*/
int f2fs_npages_for_summary_flush(struct f2fs_sb_info *sbi, bool for_ra)
@@ -3278,13 +3265,7 @@ void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
f2fs_wait_discard_bio(sbi, *new_blkaddr);
- /*
- * __add_sum_entry should be resided under the curseg_mutex
- * because, this function updates a summary entry in the
- * current summary block.
- */
- __add_sum_entry(sbi, type, sum);
-
+ curseg->sum_blk->entries[curseg->next_blkoff] = *sum;
__refresh_next_blkoff(sbi, curseg);
stat_inc_block_count(sbi, curseg);
@@ -3587,7 +3568,7 @@ void f2fs_do_replace_block(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
}
curseg->next_blkoff = GET_BLKOFF_FROM_SEG0(sbi, new_blkaddr);
- __add_sum_entry(sbi, type, sum);
+ curseg->sum_blk->entries[curseg->next_blkoff] = *sum;
if (!recover_curseg || recover_newaddr) {
if (!from_gc)