linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/3] btrfs-progs: cleanup btrfs-rescue output msgs
Date: Wed, 28 May 2014 18:24:57 +0200	[thread overview]
Message-ID: <20140528162457.GP5346@twin.jikos.cz> (raw)
In-Reply-To: <1400117349-2851-1-git-send-email-guihc.fnst@cn.fujitsu.com>

On Thu, May 15, 2014 at 09:29:07AM +0800, Gui Hecheng wrote:
> Use enum defined error codes to represent different kinds of errs
> for super-recover and chunk-recover.

I think this change hides the low-level errors (like ENOMEM) that can
possibly result into "recovery not possible", though it can be restarted
and could work fine.

The human readable error messages are good, but should also reflect if
the error was fatal or not and say "why".

Examples:

> @@ -2092,12 +2113,14 @@ int btrfs_recover_chunk_tree(char *path, int verbose, int yes)
>  	ret = recover_prepare(&rc, path);
>  	if (ret) {
>  		fprintf(stderr, "recover prepare error\n");
> +		ret = ERR_CR_FAILED_TO_RECOVER;

eg. recover_prepare can fail if it does not find the path or due to ENOMEM

>  		return ret;
>  	}
>  
>  	ret = scan_devices(&rc);
>  	if (ret) {
>  		fprintf(stderr, "scan chunk headers error\n");
> +		ret = ERR_CR_FAILED_TO_RECOVER;

device open fails, or ENOMEM

>  		goto fail_rc;
>  	}

So, somehow wrap both values into one and convert into the enhanced
messages.

  parent reply	other threads:[~2014-05-28 16:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-15  1:29 [PATCH 1/3] btrfs-progs: cleanup btrfs-rescue output msgs Gui Hecheng
2014-05-15  1:29 ` [PATCH 2/3] btrfs-progs: add missing help option for rescue super-recover Gui Hecheng
2014-05-16 16:37   ` David Sterba
2014-05-16 16:41     ` David Sterba
2014-05-19  1:35       ` Gui Hecheng
2014-05-15  1:29 ` [PATCH 3/3] btrfs-progs: use check_argc_exact to check arg number of btrfs-rescue Gui Hecheng
2014-05-28 16:24 ` David Sterba [this message]
2014-05-29  1:52   ` [PATCH 1/3] btrfs-progs: cleanup btrfs-rescue output msgs Gui Hecheng

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=20140528162457.GP5346@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=guihc.fnst@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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).