Skip to contentSkip to conversation

f2fs-tools: make fiemap command in accordance with uapi

PATCH New Daeho Jeong 1 participant 1 message Jul 21, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs-tools: make fiemap command in accordance with uapi

From: Daeho Jeong <[email protected]>

Made "fiemap" command in accordance with user api manual. So, eliminated NEW_ADDR print out and made it ends in the last extent.

---
 tools/f2fs_io/f2fs_io.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
tools/f2fs_io/f2fs_io.c +5 -4
index aa1a7e4..42dbd60 100644
@@ -757,10 +757,11 @@ static void do_fiemap(int argc, char **argv, const struct cmd_desc *cmd)
 			die_errno("FIEMAP failed");
 
 		phy_addr = fm->fm_extents[0].fe_physical / F2FS_BLKSIZE;
-		if (phy_addr == NEW_ADDR)
-			printf("NEW_ADDR ");
-		else
-			printf("%llu ", phy_addr);
+		printf("%llu: %llu\n", fm->fm_start / F2FS_BLKSIZE, phy_addr);
+
+		if (fm->fm_extents[0].fe_flags & FIEMAP_EXTENT_LAST)
+			break;
+
 		fm->fm_start += F2FS_BLKSIZE;
 	}
 	printf("\n");
Signature · 1 line
2.32.0.402.g57bb445576-goog