linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <Anand.Jain@oracle.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/1] btrfs-progs: improve troubleshooting avoid duplicate error strings
Date: Fri, 08 May 2015 16:28:24 +0800	[thread overview]
Message-ID: <554C73A8.1030406@oracle.com> (raw)
In-Reply-To: <20150414131444.GQ25622@twin.jikos.cz>





On 04/14/2015 09:14 PM, David Sterba wrote:
> On Mon, Apr 13, 2015 at 08:37:01PM +0800, Anand Jain wrote:
>> my troubleshooting experience says have unique error string per module.
>>
>> In the below eg, its one additional step to know error line,
>>
>> cat -n cmds-device.c | egrep "error removing the device"
>>     185	"ERROR: error removing the device '%s' - %s\n",
>>     190	"ERROR: error removing the device '%s' - %s\n",
>>
>> which is completely avoidable.
>
> It is, we can merge both branches into one.



>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>>   cmds-device.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/cmds-device.c b/cmds-device.c
>> index 1c72e90..1c32771 100644
>> --- a/cmds-device.c
>> +++ b/cmds-device.c
>> @@ -187,7 +187,7 @@ static int cmd_rm_dev(int argc, char **argv)
>>   			ret++;
>>   		} else if (res < 0) {
>>   			fprintf(stderr,
>> -				"ERROR: error removing the device '%s' - %s\n",
>> +				"ERROR: ioctl error removing the device '%s' - %s\n",
>
> The only difference is the strerror vs btrfs_err_str. As both ret > 0
> and ret < 0 report some kind of error, the wording would be very similar
> so I think that one error message would fit better. I'll fix that.

You means res not ret (above) ?
--------------------------------------------------------------
diff --git a/cmds-device.c b/cmds-device.c
index cbb3243..1022656 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -183,7 +183,7 @@ static int cmd_rm_dev(int argc, char **argv)
                 if (res) {
                         const char *msg;

-                       if (ret > 0)
+                       if (res > 0)
                                 msg = btrfs_err_str(res);
                         else
                                 msg = strerror(e);
--------------------------------------------------------------

Thanks, Anand


> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  reply	other threads:[~2015-05-08  8:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13 12:37 [PATCH 1/1] btrfs-progs: improve troubleshooting avoid duplicate error strings Anand Jain
2015-04-13 13:40 ` Marc MERLIN
2015-04-14 13:14 ` David Sterba
2015-05-08  8:28   ` Anand Jain [this message]
2015-05-11 11:23     ` David Sterba

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=554C73A8.1030406@oracle.com \
    --to=anand.jain@oracle.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).