Skip to contentSkip to conversation

f2fs-tools: fix typo of HAVE_PREAD macro and remove duplicate semicolons

PATCH Superseded Xiaole He 2 participants 3 messages Nov 21, 2025 – Nov 25, 2025 Library code

lore
Share & tools
lore

Xiaole He

author
#0 lore raw

PATCH 1/1 f2fs-tools: fix typo of HAVE_PREAD macro and remove duplicate semicolons

1. Fix typo in HAVE_PREAD macro check (lib/libf2fs_io.c:403):
- Change HAVE_RPEAD -> HAVE_PREAD
- The misspelled macro caused pread() optimization to never be used, forcing the code to always use the slower lseek() + read() path instead of the atomic pread() call.

2. Remove duplicate semicolons:
- mkfs/f2fs_format.c:211: Remove extra semicolon in hot_ext_count assignment
- fsck/dump.c:119: Remove extra semicolon in free_segs initialization

These are minor code quality fixes that don't change functionality but improve code correctness and enable the pread() optimization.

---
 fsck/dump.c        | 2 +-
 lib/libf2fs_io.c   | 2 +-
 mkfs/f2fs_format.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
fsck/dump.c +1 -1
index 21de2ac..f5c95de 100644
@@ -116,7 +116,7 @@ void sit_dump(struct f2fs_sb_info *sbi, unsigned int start_sit,
 	struct sit_info *sit_i = SIT_I(sbi);
 	unsigned int segno;
 	char buf[BUF_SZ];
-	u32 free_segs = 0;;
+	u32 free_segs = 0;
 	u64 valid_blocks = 0;
 	int ret;
 	int fd, i;
lib/libf2fs_io.c +1 -1
index 2030440..c31f3b8 100644
@@ -400,7 +400,7 @@ int dev_read_version(void *buf, __u64 offset, size_t len)
 {
 	if (c.sparse_mode)
 		return 0;
-#ifdef HAVE_RPEAD
+#ifdef HAVE_PREAD
 	if (pread(c.kd, buf, len, (off_t)offset) < 0)
 		return -1;
 #else
mkfs/f2fs_format.c +1 -1
index 6deb671..d05e897 100644
@@ -208,7 +208,7 @@ static void cure_extension_list(void)
 		if (i == 0)
 			set_sb(extension_count, pos);
 		else
-			sb->hot_ext_count = pos - get_sb(extension_count);;
+			sb->hot_ext_count = pos - get_sb(extension_count);
 
 		if (!ext_str)
 			continue;
Signature · 8 lines
2.43.0



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
author
#1 lore raw

PATCH v2 1/1 f2fs-tools: fix typo of HAVE_PREAD macro and remove duplicate semicolons

1. Fix typo in HAVE_PREAD macro check (lib/libf2fs_io.c:403):
- Change HAVE_RPEAD -> HAVE_PREAD
- The misspelled macro caused pread() optimization to never be used, forcing the code to always use the slower lseek() + read() path instead of the atomic pread() call.

2. Remove duplicate semicolons:
- mkfs/f2fs_format.c:211: Remove extra semicolon in hot_ext_count assignment
- fsck/dump.c:119: Remove extra semicolon in free_segs initialization

These are minor code quality fixes that don't change functionality but improve code correctness and enable the pread() optimization.

Fixes 4b7e95300988 ("f2fs-tools: use pread and pwrite when they are available.")

---
Changes in v2:
- Add Fixes tag

---
 fsck/dump.c        | 2 +-
 lib/libf2fs_io.c   | 2 +-
 mkfs/f2fs_format.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
fsck/dump.c +1 -1
index 21de2ac..f5c95de 100644
@@ -116,7 +116,7 @@ void sit_dump(struct f2fs_sb_info *sbi, unsigned int start_sit,
 	struct sit_info *sit_i = SIT_I(sbi);
 	unsigned int segno;
 	char buf[BUF_SZ];
-	u32 free_segs = 0;;
+	u32 free_segs = 0;
 	u64 valid_blocks = 0;
 	int ret;
 	int fd, i;
lib/libf2fs_io.c +1 -1
index 2030440..c31f3b8 100644
@@ -400,7 +400,7 @@ int dev_read_version(void *buf, __u64 offset, size_t len)
 {
 	if (c.sparse_mode)
 		return 0;
-#ifdef HAVE_RPEAD
+#ifdef HAVE_PREAD
 	if (pread(c.kd, buf, len, (off_t)offset) < 0)
 		return -1;
 #else
mkfs/f2fs_format.c +1 -1
index 6deb671..d05e897 100644
@@ -208,7 +208,7 @@ static void cure_extension_list(void)
 		if (i == 0)
 			set_sb(extension_count, pos);
 		else
-			sb->hot_ext_count = pos - get_sb(extension_count);;
+			sb->hot_ext_count = pos - get_sb(extension_count);
 
 		if (!ext_str)
 			continue;
Signature · 8 lines
2.43.0



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Reviewed-by Chao Yu on v2 1/1
#2 lore raw
Quoted 10 lines · Xiaole He

1. Fix typo in HAVE_PREAD macro check (lib/libf2fs_io.c:403):
- Change HAVE_RPEAD -> HAVE_PREAD
- The misspelled macro caused pread() optimization to never be used, forcing the code to always use the slower lseek() + read() path instead of the atomic pread() call.

2. Remove duplicate semicolons:
- mkfs/f2fs_format.c:211: Remove extra semicolon in hot_ext_count assignment
- fsck/dump.c:119: Remove extra semicolon in free_segs initialization

Quoted 5 lines

These are minor code quality fixes that don't change functionality but improve code correctness and enable the pread() optimization.

Fixes 4b7e95300988 ("f2fs-tools: use pread and pwrite when they are available.")

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel