gfs2-utils: master - mkfs.gfs2: print message about BKLDISCARD ioctl taking a long time

Paul Evans pevans at fedoraproject.org
Mon Oct 19 13:08:35 UTC 2015


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=2ad0448631bdc37a82d6e7db4e48ea48b892716c
Commit:        2ad0448631bdc37a82d6e7db4e48ea48b892716c
Parent:        cbb17b94ce6aa3813f0544acd8e1f3c6f8d4f038
Author:        Paul Evans <pevans at redhat.com>
AuthorDate:    Thu Oct 15 16:40:25 2015 +0100
Committer:     Paul Evans <pevans at redhat.com>
CommitterDate: Mon Oct 19 14:07:49 2015 +0100

mkfs.gfs2: print message about BKLDISCARD ioctl taking a long time

When running mkfs.gfs2 the BLKDISCARD ioctl() can sit waiting for a
long time without feedback.

Added a message in mkfs.gfs2 to the user just before the ioctl begins
to warn the user that the operation could take a while to complete.

Signed-off-by: Paul Evans <pevans at redhat.com>
---
 gfs2/mkfs/main_mkfs.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index ab525d1..48345b5 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -923,9 +923,17 @@ int main(int argc, char *argv[])
 	if (opts.confirm && !opts.override)
 		are_you_sure();
 
-	if (!S_ISREG(opts.dev.stat.st_mode) && opts.discard)
+	if (!S_ISREG(opts.dev.stat.st_mode) && opts.discard) {
+		if (!opts.quiet) {
+			printf("%s", _("Discarding device contents (may take a while on large devices): "));
+			fflush(stdout);
+		}
 		discard_blocks(opts.dev.fd, opts.dev.size, opts.debug);
 
+		if (!opts.quiet)
+			printf("%s", _("Done\n"));
+	}
+
 	error = place_rgrps(&sbd, rgs, &opts);
 	if (error) {
 		fprintf(stderr, _("Failed to build resource groups\n"));


More information about the cluster-commits mailing list