linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
To: <dsterba@suse.cz>
Cc: <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 1/3] btrfs-progs: cleanup btrfs-rescue output msgs
Date: Thu, 29 May 2014 09:52:20 +0800	[thread overview]
Message-ID: <1401328340.12380.19.camel@localhost.localdomain> (raw)
In-Reply-To: <20140528162457.GP5346@twin.jikos.cz>

On Wed, 2014-05-28 at 18:24 +0200, David Sterba wrote:
> 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.

Hi David,
Thanks for your advice. I'll rework it soon and resend.

Something to confirm below:

o Actually I've kept almost all the "fprintf"s in the original place as
*low level* messages(except an "PTR_ERR", I'll add it back).
But it seems that the original "fprintf"s do hide low level errors, and
I'll try to enhance them in the original "fprintf"s.

o What I've added are just some *user level* messages which will show
along with the low level messages, bug not replace them.
I would like to just keep this part.

What do you think?

-Gui



      reply	other threads:[~2014-05-29  1:57 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 ` [PATCH 1/3] btrfs-progs: cleanup btrfs-rescue output msgs David Sterba
2014-05-29  1:52   ` Gui Hecheng [this message]

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=1401328340.12380.19.camel@localhost.localdomain \
    --to=guihc.fnst@cn.fujitsu.com \
    --cc=dsterba@suse.cz \
    --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).