Skip to contentSkip to conversation

mkfs.f2fs: show correct partition size

PATCH New Jaegeuk Kim 1 participant 1 message Dec 8, 2015 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mkfs.f2fs: show correct partition size

It needs to consider different sector size when showing the total size.

---
 lib/libf2fs.c           | 3 ++-
 mkfs/f2fs_format_main.c | 7 +------
 2 files changed, 3 insertions(+), 7 deletions(-)
lib/libf2fs.c +2 -1
index 32e0651..0ac9994 100644
@@ -503,7 +503,8 @@ int f2fs_get_device_info(struct f2fs_configuration *c)
 	}
 	MSG(0, "Info: sector size = %u\n", c->sector_size);
 	MSG(0, "Info: total sectors = %"PRIu64" (%"PRIu64" MB)\n",
-				c->total_sectors, c->total_sectors >> 11);
+				c->total_sectors, (c->total_sectors *
+					(c->sector_size >> 9)) >> 11);
 	return 0;
 }
 
mkfs/f2fs_format_main.c +1 -6
index 0eee81a..243f0e9 100644
@@ -126,13 +126,8 @@ static void f2fs_parse_options(int argc, char *argv[])
 	}
 	config.device_name = argv[optind];
 
-	if ((optind + 1) < argc) {
-		/* We have a sector count. */
+	if ((optind + 1) < argc)
 		config.total_sectors = atoll(argv[optind+1]);
-		MSG(1, "\ttotal_sectors=%"PRIx64" (%"PRIx64" bytes)\n",
-				config.total_sectors,
-				config.total_sectors * 512);
-	}
 	config.segs_per_zone = config.segs_per_sec * config.secs_per_zone;
 }
 
Signature · 4 lines
2.4.9 (Apple Git-60)


------------------------------------------------------------------------------