The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] fsck.f2fs: fix null buffer error with dev_fill
@ 2025-05-21 19:41 Daeho Jeong
  2025-05-22  3:42 ` [f2fs-dev] " Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Daeho Jeong @ 2025-05-21 19:41 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong

From: Daeho Jeong <daehojeong@google.com>

Make fsck use dev_fill_block() with zeroed buffer instead of dev_fill().

Signed-off-by: Daeho Jeong <daehojeong@google.com>
---
 fsck/fsck.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index 893eea7..4d05e1b 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -3526,15 +3526,22 @@ static int chk_and_fix_wp_with_sit(int UNUSED(i), void *blkzone, void *opaque)
 
 	ret = f2fs_finish_zone(wpd->dev_index, blkz);
 	if (ret) {
+		u8 buffer[F2FS_BLKSIZE] = {};
+		u64 blk_addr = wp_block;
 		u64 fill_sects = blk_zone_length(blkz) -
 			(blk_zone_wp_sector(blkz) - blk_zone_sector(blkz));
+		size_t len = fill_sects >> log_sectors_per_block;
 		struct seg_entry *se = get_seg_entry(sbi, wp_segno);
+		enum rw_hint whint = f2fs_io_type_to_rw_hint(se->type);
+
 		printf("[FSCK] Finishing zone failed: %s\n", dev->path);
-		ret = dev_fill(NULL, wp_block * F2FS_BLKSIZE,
-			(fill_sects >> log_sectors_per_block) * F2FS_BLKSIZE,
-			f2fs_io_type_to_rw_hint(se->type));
-		if (ret)
-			printf("[FSCK] Fill up zone failed: %s\n", dev->path);
+		while (len--) {
+			ret = dev_fill_block(buffer, blk_addr++, whint);
+			if (ret) {
+				printf("[FSCK] Fill up zone failed: %s\n", dev->path);
+				break;
+			}
+		}
 	}
 
 	if (!ret)
-- 
2.49.0.1143.g0be31eac6b-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [f2fs-dev] [PATCH] fsck.f2fs: fix null buffer error with dev_fill
  2025-05-21 19:41 [PATCH] fsck.f2fs: fix null buffer error with dev_fill Daeho Jeong
@ 2025-05-22  3:42 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2025-05-22  3:42 UTC (permalink / raw)
  To: Daeho Jeong, linux-kernel, linux-f2fs-devel, kernel-team
  Cc: chao, Daeho Jeong

On 5/22/25 03:41, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
> 
> Make fsck use dev_fill_block() with zeroed buffer instead of dev_fill().
> 
> Signed-off-by: Daeho Jeong <daehojeong@google.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-22  3:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-21 19:41 [PATCH] fsck.f2fs: fix null buffer error with dev_fill Daeho Jeong
2025-05-22  3:42 ` [f2fs-dev] " Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox