linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [PATCH] mkfs.f2fs: show correct partition size
Date: Tue,  8 Dec 2015 13:15:48 -0800	[thread overview]
Message-ID: <1449609348-10782-1-git-send-email-jaegeuk@kernel.org> (raw)

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

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 lib/libf2fs.c           | 3 ++-
 mkfs/f2fs_format_main.c | 7 +------
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index 32e0651..0ac9994 100644
--- a/lib/libf2fs.c
+++ b/lib/libf2fs.c
@@ -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;
 }
 
diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c
index 0eee81a..243f0e9 100644
--- a/mkfs/f2fs_format_main.c
+++ b/mkfs/f2fs_format_main.c
@@ -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;
 }
 
-- 
2.4.9 (Apple Git-60)


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

                 reply	other threads:[~2015-12-08 21:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449609348-10782-1-git-send-email-jaegeuk@kernel.org \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).