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>
This commit is contained in:
Bart Van Assche 2022-06-23 11:12:08 -07:00 committed by sunshenshen
parent 4a727688e1
commit 3b2251bbfc

View File

@ -1894,7 +1894,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++);
@ -1954,7 +1954,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);
@ -1964,7 +1964,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);
}
@ -2030,7 +2030,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;