diff options
author | Bart Van Assche <bvanassche@acm.org> | 2022-06-23 11:12:08 -0700 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2022-07-21 19:28:18 -0700 |
commit | 6325cf71b0fa11150a2909d33f28fde5dd69ced8 (patch) | |
tree | bb127fd41d24a18cf6478141b9c6cce9e19738cc | |
parent | c89be7a8915086a1b99ca6f80f3ffa36a26ae680 (diff) | |
download | f2fs-tools-6325cf71b0fa11150a2909d33f28fde5dd69ced8.tar.gz |
Use F2FS_BLKSIZE as the size of struct f2fs_summary_block
Since the size of struct f2fs_summary_block equals F2FS_BLKSIZE, use
F2FS_BLKSIZE instead of PAGE_CACHE_SIZE as the size of struct
f2fs_summary_block.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fsck/mount.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fsck/mount.c b/fsck/mount.c index cc871fe..584e6d1 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -1854,7 +1854,7 @@ static void read_compacted_summaries(struct f2fs_sb_info *sbi) curseg->sum_blk->entries[j] = *s; offset += SUMMARY_SIZE; if (offset + SUMMARY_SIZE <= - PAGE_CACHE_SIZE - SUM_FOOTER_SIZE) + F2FS_BLKSIZE - SUM_FOOTER_SIZE) continue; memset(kaddr, 0, F2FS_BLKSIZE); ret = dev_read_block(kaddr, start++); @@ -1914,7 +1914,7 @@ static void read_normal_summaries(struct f2fs_sb_info *sbi, int type) blk_addr = GET_SUM_BLKADDR(sbi, segno); } - sum_blk = (struct f2fs_summary_block *)malloc(PAGE_SIZE); + sum_blk = malloc(sizeof(*sum_blk)); ASSERT(sum_blk); ret = dev_read_block(sum_blk, blk_addr); @@ -1924,7 +1924,7 @@ static void read_normal_summaries(struct f2fs_sb_info *sbi, int type) restore_node_summary(sbi, segno, sum_blk); curseg = CURSEG_I(sbi, type); - memcpy(curseg->sum_blk, sum_blk, PAGE_CACHE_SIZE); + memcpy(curseg->sum_blk, sum_blk, sizeof(*sum_blk)); reset_curseg(sbi, type); free(sum_blk); } @@ -1990,7 +1990,7 @@ static int build_curseg(struct f2fs_sb_info *sbi) SM_I(sbi)->curseg_array = array; for (i = 0; i < NR_CURSEG_TYPE; i++) { - array[i].sum_blk = calloc(PAGE_CACHE_SIZE, 1); + array[i].sum_blk = calloc(sizeof(*(array[i].sum_blk)), 1); if (!array[i].sum_blk) { MSG(1, "\tError: Calloc failed for build_curseg!!\n"); goto seg_cleanup; |