linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Bart Van Assche <bvanassche@acm.org>,
	linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH v2 5/5] Use F2FS_BLKSIZE as the size of struct f2fs_summary_block
Date: Thu, 23 Jun 2022 11:12:08 -0700	[thread overview]
Message-ID: <20220623181208.3596448-6-bvanassche@acm.org> (raw)
In-Reply-To: <20220623181208.3596448-1-bvanassche@acm.org>

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>
---
 fsck/mount.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fsck/mount.c b/fsck/mount.c
index cc871fea5d10..584e6d1370ae 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;


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  parent reply	other threads:[~2022-06-23 18:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23 18:12 [f2fs-dev] [PATCH v2 0/5] PAGE_SIZE and zoned storage related improvements Bart Van Assche
2022-06-23 18:12 ` [f2fs-dev] [PATCH v2 1/5] Fix the struct f2fs_dentry_block definition Bart Van Assche
2022-06-23 18:24   ` Peter Collingbourne via Linux-f2fs-devel
2022-07-17  3:35   ` Chao Yu
2022-06-23 18:12 ` [f2fs-dev] [PATCH v2 2/5] Fix f2fs_report_zone() Bart Van Assche
2022-07-17  3:35   ` Chao Yu
2022-06-23 18:12 ` [f2fs-dev] [PATCH v2 3/5] Improve compile-time type checking for f2fs_report_zone() Bart Van Assche
2022-07-17  3:36   ` Chao Yu
2022-06-23 18:12 ` [f2fs-dev] [PATCH v2 4/5] Use F2FS_BLKSIZE for dev_read_block() buffers Bart Van Assche
2022-07-17  3:37   ` Chao Yu
2022-06-23 18:12 ` Bart Van Assche [this message]
2022-07-17  3:39   ` [f2fs-dev] [PATCH v2 5/5] Use F2FS_BLKSIZE as the size of struct f2fs_summary_block Chao Yu
2022-08-24 17:41 ` [f2fs-dev] [PATCH v2 0/5] PAGE_SIZE and zoned storage related improvements Bart Van Assche
2022-08-24 20:34   ` Jaegeuk Kim
2022-08-25 17:21     ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220623181208.3596448-6-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).