improve a few messages in mkfs and xfs_copy
Hi all,
these patches have been in my stash for a while and improve messages that confused me when I ran into them to be a bit more useful.
PATCH 1/3 xfs_copy: improve the error message when mkfs is in progress
Indicate the correct reason for the failure instead of the same message as for the generic error condition just above.
Signed-off-by Christoph Hellwig <[email protected]>
--- copy/xfs_copy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
copy/xfs_copy.c +1 -1
@@ -759,7 +759,7 @@ main(int argc, char **argv) "%s: Aborting.\n"), progname, source_name, progname);exit (1 ); }else if (mp->m_sb.sb_inprogress) { -do_log (_ ("%s %s filesystem failed to initialize\n" +do_log (_ ("%s mkfs for %s filesystem still in progress\n" "%s: Aborting.\n" ), progname, source_name, progname);exit (1 ); }else if (mp->m_sb.sb_logstart ==0 ) {
Signature · 1 line
2.47.3
PATCH 2/3 mkfs: improve the error message from check_device_type
In reply to Christoph HellwigTell the user what device is missing.
Signed-off-by Christoph Hellwig <[email protected]>
--- mkfs/xfs_mkfs.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
mkfs/xfs_mkfs.c +8 -4
@@ -1333,6 +1333,7 @@ check_device_type(struct libxfs_dev *dev, bool no_size, bool dry_run, + const char *device_type, const char *optname) { struct stat statbuf;
@@ -1345,7 +1346,8 @@ check_device_type( }if (!dev->name) { -fprintf (stderr,_ ("No device name specified\n" )); +fprintf (stderr,_ ("No %s device name specified\n" ), + device_type);usage (); }
@@ -2376,11 +2378,13 @@ validate_sectorsize(* Before anything else, verify that we are correctly operating on * files or block devices and set the control parameters correctly. */ -check_device_type (&cli->xi->data, !cli->dsize, dry_run,"d" ); +check_device_type (&cli->xi->data, !cli->dsize, dry_run,"data" ,"d" );if (!cli->loginternal) -check_device_type (&cli->xi->log, !cli->logsize, dry_run,"l" ); +check_device_type (&cli->xi->log, !cli->logsize, dry_run,"log" , +"l" );if (cli->xi->rt.name) -check_device_type (&cli->xi->rt, !cli->rtsize, dry_run,"r" ); +check_device_type (&cli->xi->rt, !cli->rtsize, dry_run,"RT" , +"r" );/* * Explicitly disable direct IO for image files so we don't error out on
Signature · 1 line
2.47.3
PATCH 3/3 mkfs: improve the error message in adjust_nr_zones
In reply to Christoph HellwigPrint the zone counts to help the user to understand the problem.
Signed-off-by Christoph Hellwig <[email protected]>
--- mkfs/xfs_mkfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
mkfs/xfs_mkfs.c +3 -3
@@ -4552,11 +4552,11 @@ adjust_nr_zones(if (!cli->rgcount) cfg->rgcount +=XFS_RESERVED_ZONES ;if (cfg->rgcount > max_zones) { - cfg->rgcount = max_zones;fprintf (stderr, -_ ("Warning: not enough zones for backing requested rt size due to\n" +_ ("Warning: not enough zones (%lu/%u) for backing requested rt size due to\n" "over-provisioning needs, writable size will be less than %s\n" ), - cli->rtsize); + cfg->rgcount, max_zones, cli->rtsize); + cfg->rgcount = max_zones; } new_rtblocks = (cfg->rgcount * cfg->rgsize); slack = (new_rtblocks - cfg->rtblocks) % cfg->rgsize;
Signature · 1 line
2.47.3
Andrey Albershteyn
Reviewed-byQuoted 6 lines · Christoph Hellwig
Hi all,
these patches have been in my stash for a while and improve messages that confused me when I ran into them to be a bit more useful.
lgtm
Reviewed-by Andrey Albershteyn <[email protected]>
Signature · 1 line
- Andrey