mkfs.gfs2: print message about BKLDISCARD ioctl taking a long time
PATCH 1/1 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.
--- gfs2/mkfs/main_mkfs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
gfs2/mkfs/main_mkfs.c +9 -1
@@ -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" ));
Signature · 1 line
1.9.3
PATCH 1/1 mkfs.gfs2: print message about BKLDISCARD ioctl taking a long time
Hi Paul,
Quoted 16 lines · Paul Evans
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 <[email protected]>--- gfs2/mkfs/main_mkfs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)gfs2/mkfs/main_mkfs.c +0
-0
gfs2/mkfs/main_mkfs.c int main(int argc, char *argv[]) · line 909
Quoted 7 lines
gfs2/mkfs/main_mkfs.c +3
-1@@ -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
Quoted 12 lines
gfs2/mkfs/main_mkfs.c +6
-0+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" ));