From patchwork Fri May 8 08:28:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 6363421 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 882249F1C2 for ; Fri, 8 May 2015 08:31:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C586F201FE for ; Fri, 8 May 2015 08:31:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B25BD201F5 for ; Fri, 8 May 2015 08:31:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752505AbbEHIbL (ORCPT ); Fri, 8 May 2015 04:31:11 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:47362 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751396AbbEHIbJ (ORCPT ); Fri, 8 May 2015 04:31:09 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t488V6Fr030283 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 8 May 2015 08:31:06 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t488V64g027735 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 8 May 2015 08:31:06 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t488V6B5011923; Fri, 8 May 2015 08:31:06 GMT Received: from [10.186.101.18] (/10.186.101.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 08 May 2015 01:31:06 -0700 Message-ID: <554C73A8.1030406@oracle.com> Date: Fri, 08 May 2015 16:28:24 +0800 From: Anand Jain User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: dsterba@suse.cz, linux-btrfs@vger.kernel.org Subject: Re: [PATCH 1/1] btrfs-progs: improve troubleshooting avoid duplicate error strings References: <1428928621-8001-1-git-send-email-anand.jain@oracle.com> <20150414131444.GQ25622@twin.jikos.cz> In-Reply-To: <20150414131444.GQ25622@twin.jikos.cz> X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 >> --- >> 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) ? -------------------------------------------------------------- -------------------------------------------------------------- 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 > --- 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 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);