All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] btrfs-progs: improve troubleshooting avoid duplicate error strings
@ 2015-04-13 12:37 Anand Jain
  2015-04-13 13:40 ` Marc MERLIN
  2015-04-14 13:14 ` David Sterba
  0 siblings, 2 replies; 5+ messages in thread
From: Anand Jain @ 2015-04-13 12:37 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

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.

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",
 				argv[i], strerror(e));
 			ret++;
 		}
-- 
2.0.0.153.g79dcccc


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] btrfs-progs: improve troubleshooting avoid duplicate error strings
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Marc MERLIN @ 2015-04-13 13:40 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs, dsterba

On Mon, Apr 13, 2015 at 08:37:01PM +0800, Anand Jain wrote:
> my troubleshooting experience says have unique error string per module.

+1 to that, thank you.

Marc

> 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.
> 
> 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",
>  				argv[i], strerror(e));
>  			ret++;
>  		}
> -- 
> 2.0.0.153.g79dcccc
> 
> --
> 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
> 

-- 
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/  

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] btrfs-progs: improve troubleshooting avoid duplicate error strings
  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
  1 sibling, 1 reply; 5+ messages in thread
From: David Sterba @ 2015-04-14 13:14 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs, dsterba

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] btrfs-progs: improve troubleshooting avoid duplicate error strings
  2015-04-14 13:14 ` David Sterba
@ 2015-05-08  8:28   ` Anand Jain
  2015-05-11 11:23     ` David Sterba
  0 siblings, 1 reply; 5+ messages in thread
From: Anand Jain @ 2015-05-08  8:28 UTC (permalink / raw)
  To: dsterba, linux-btrfs





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
>

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] btrfs-progs: improve troubleshooting avoid duplicate error strings
  2015-05-08  8:28   ` Anand Jain
@ 2015-05-11 11:23     ` David Sterba
  0 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2015-05-11 11:23 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs

On Fri, May 08, 2015 at 04:28:24PM +0800, Anand Jain wrote:
> >> @@ -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) ?

Oh right, please send a patch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-05-11 11:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2015-05-11 11:23     ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.