Skip to contentSkip to conversation

f2fs-tools: fix the total_zones calculation in f2fs_prepare_super_block

PATCH New Wang Sheng-Hui 1 participant 1 message Jun 28, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs-tools: fix the total_zones calculation in f2fs_prepare_super_block

We can count the main area as the data zones. Remove the '-1' miscalcuation.

---
  mkfs/f2fs_format.c |    5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
mkfs/f2fs_format.c +2 -3
index f00ba04..4d7ea84 100644
@@ -372,9 +372,8 @@ static int f2fs_prepare_super_block(void)
  	super_block.meta_ino = cpu_to_le32(2);
  	super_block.root_ino = cpu_to_le32(3);
 
-	total_zones = ((le32_to_cpu(super_block.segment_count_main) - 1) /
-			config.segs_per_sec) /
-			config.secs_per_zone;
+	total_zones = le32_to_cpu(super_block.segment_count_main) /
+			(config.segs_per_sec * config.secs_per_zone);
  	if (total_zones <= 6) {
  		MSG(1, "\tError: %d zones: Need more zones \
  			by shrinking zone size\n", total_zones);
Signature · 9 lines
1.7.10.4


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev