cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH] mkfs.gfs2: print message about BKLDISCARD ioctl taking a long time
@ 2015-09-24 18:27 Paul Evans
  2015-09-25  8:47 ` Andrew Price
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Evans @ 2015-09-24 18:27 UTC (permalink / raw)
  To: cluster-devel.redhat.com

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@redhat.com>
---
 gfs2/mkfs/main_mkfs.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index d3d8edf..005b6f8 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -904,9 +904,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", _("\nDiscarding old blocks (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"));
-- 
1.9.3



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Cluster-devel] [PATCH] mkfs.gfs2: print message about BKLDISCARD ioctl taking a long time
  2015-09-24 18:27 [Cluster-devel] [PATCH] mkfs.gfs2: print message about BKLDISCARD ioctl taking a long time Paul Evans
@ 2015-09-25  8:47 ` Andrew Price
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Price @ 2015-09-25  8:47 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi Paul,

On 24/09/15 19:27, Paul Evans wrote:
> 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@redhat.com>
> ---
>   gfs2/mkfs/main_mkfs.c | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
> index d3d8edf..005b6f8 100644
> --- a/gfs2/mkfs/main_mkfs.c
> +++ b/gfs2/mkfs/main_mkfs.c
> @@ -904,9 +904,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", _("\nDiscarding old blocks (may take a while on large devices): "));

"Discarding device contents" is probably more accurate. The string 
shouldn't need to start with a '\n' though. If a previous message didn't 
end with a '\n' then that message should be fixed instead, but if it's 
just to add a blank I would prefer to remove it.

Otherwise, it looks good.

Thanks,
Andy

> +			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"));
>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-25  8:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-24 18:27 [Cluster-devel] [PATCH] mkfs.gfs2: print message about BKLDISCARD ioctl taking a long time Paul Evans
2015-09-25  8:47 ` Andrew Price

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).