Received: by 10.223.185.116 with SMTP id b49csp1898663wrg; Mon, 12 Feb 2018 00:16:34 -0800 (PST) X-Google-Smtp-Source: AH8x225Mdqk8llLBMZWpaUOXnHg+rmQxMzIWvGOhw9ofZttNATQfxfMoRzNxtyRhdOFn57Cv2//l X-Received: by 10.98.220.6 with SMTP id t6mr11011324pfg.20.1518423394555; Mon, 12 Feb 2018 00:16:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518423394; cv=none; d=google.com; s=arc-20160816; b=UbjYl5Kvw3Eot/QzP+gB3brKx4LThKdAgP3RDi5b7+X2GuuQspdZGQUOq7R6O09omu Jy+M0bNsQTy7ekJzh7uPLJVJ6hNMj/AAqek/DgsiFT+wFTTCsrB0HUtF2zIol7LTeMoX Qj3mqIVa0nosbwkGTKXwbAEsjILZK4UBF11ajGuGKAh5++MS4UPvp43y7Ir/XhwKBpZt QcF88rShBCfrVJZhmYOryKprPxbqHetG1X5SmNOGfTniXmD8erwr5czZe+JW5jfjskir cS4Ldo6LY6n6+Jwc0fLJfbvrg89zMBwiDS4c7dLcsrBhQucak+equB3paVI/tBy4eviI mJ9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=ebpeR5yk3oCjd7REgyHfAw3O56b3ApcyZQauI1VZ+J4=; b=vhaI7ruSDhY9p7vUkkEEVAM/nj+YqTrX9ewuk4y1fIO2oRccymXBbAmFbhQvLQjX52 fZlPWQ7NB5OdicBrBDyL4UQDimOk1+fjGhWNC+cljKbp52q4ADm2evhEh7wr9HxBhM65 G5VcN0+koDYGjfbCBZG//J1+026BjcDOd1Azb82KCIs2bTN2z0DX2iuszDKa4TUtiqCp QHrOXDRa3YaR8aWuGuhSX2hAvLtpqxLmwpfOlhqfKuVE3z2Cyr+RPmRhIn3wylWGJutz mo3cwCkp40yB67VthJVFx8W/VXFUgCgm7/Ysj6yL25XWl4aeyQpLEQsFHylLM09lBG4I wScA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=JS1b1FDj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m16si1837455pgn.290.2018.02.12.00.16.19; Mon, 12 Feb 2018 00:16:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=JS1b1FDj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932816AbeBLHqz (ORCPT + 99 others); Mon, 12 Feb 2018 02:46:55 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:58702 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932720AbeBLHqx (ORCPT ); Mon, 12 Feb 2018 02:46:53 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1C7g6en078870; Mon, 12 Feb 2018 07:46:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=ebpeR5yk3oCjd7REgyHfAw3O56b3ApcyZQauI1VZ+J4=; b=JS1b1FDj94JSLj+QPdQ0G4riYggGmEEuSGdsDpY7qH+gsmNZ/4A+HukXKDAXB4ktiC3K +2QLEqFP6xh/pKcVzCW5br5MY7m5a029azyLnvQTqy+0ey07ubFLAnpbgHfh99cuJO57 OAS0jaFxbDymNLmdYI+uyrh11RwSS9PlQQFLAf8gt5FuujapUktdGpgigUuwYYlOFVTO YKrMO/z6XZVU0J6m8NwLLeToHI5+O7Q8FqjbWuKXORtdS53lldFL531xPTUIu/vIXEih Hg3yFaS9ni8c92R0uzUJyiHWPzNbiqulqtHdRedN2TgisQtMjQqsB03Fwch+E3IxgXnI Fw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2g367tg43t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Feb 2018 07:46:18 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w1C7fHSD000868 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2018 07:41:17 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w1C7fFYb009814; Mon, 12 Feb 2018 07:41:16 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 11 Feb 2018 23:41:15 -0800 Date: Mon, 12 Feb 2018 10:41:07 +0300 From: Dan Carpenter To: NeilBrown Cc: James Simmons , Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin , wang di , Linux Kernel Mailing List , Lustre Development List Subject: Re: [PATCH 41/80] staging: lustre: lmv: separate master object with master stripe Message-ID: <20180212074107.ulp52nikjv5m5mf2@mwanda> References: <1471378773-24590-1-git-send-email-jsimmons@infradead.org> <1471378773-24590-42-git-send-email-jsimmons@infradead.org> <87r2pvkkl5.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87r2pvkkl5.fsf@notabene.neil.brown.name> User-Agent: NeoMutt/20170609 (1.8.3) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8802 signatures=668668 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802120101 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 09, 2018 at 12:39:18PM +1100, NeilBrown wrote: > On Tue, Aug 16 2016, James Simmons wrote: > > > > > +static inline bool > > +lsm_md_eq(const struct lmv_stripe_md *lsm1, const struct lmv_stripe_md *lsm2) > > +{ > > + int idx; > > + > > + if (lsm1->lsm_md_magic != lsm2->lsm_md_magic || > > + lsm1->lsm_md_stripe_count != lsm2->lsm_md_stripe_count || > > + lsm1->lsm_md_master_mdt_index != lsm2->lsm_md_master_mdt_index || > > + lsm1->lsm_md_hash_type != lsm2->lsm_md_hash_type || > > + lsm1->lsm_md_layout_version != lsm2->lsm_md_layout_version || > > + !strcmp(lsm1->lsm_md_pool_name, lsm2->lsm_md_pool_name)) > > + return false; > > Hi James and all, > This patch (8f18c8a48b736c2f in linux) is different from the > corresponding patch in lustre-release (60e07b972114df). > > In that patch, the last clause in the 'if' condition is > > + strcmp(lsm1->lsm_md_pool_name, > + lsm2->lsm_md_pool_name) != 0) > > Whoever converted it to "!strcmp()" inverted the condition. This is a > perfect example of why I absolutely *loathe* the "!strcmp()" construct!! People think that "if (!strcmp()) " is prefered kernel style but it's not. if (foo != NULL) { The != NULL is a double negative. I don't think it adds anything. Some kernel developers like this style because it's explicit about the type. I have never seen any bugs caused by this format or solved by this format. Anyway checkpatch complains. if (ret != 0) { In this situation "ret" is not a number, it's an error code. The != 0 is a double negative and complicated to think about. Btw, I sort of prefer "if (ret)" to "if (ret < 0)", not because of style but it's easier for Smatch. No subsystems are totally consistent so the (by definition inconsistent) "if (ret < 0)" checks cause false positives in Smatch. if (len != 0) This is OK. "len" is a number. if (strcmp(one, two) != 0) { With strcmp() I really prefer == 0 and != 0 because it works like this: strcmp(one, two) == 0 --> means one == two strcmp(one, two) < 0 --> means one < two strcmp(one, two) != 0 --> means one != two Either style is accepted in the kernel but I think == 0 just makes so much sense. I mostly see bugs from this when people are "fixing" the style from == 0 to !strcmp() so my sample is very biased. Normally, if the original author writes the code any bugs are caught in testing so either way is going to be bug free. But the only thing that checkpatch complains about is == NULL and != NULL. regards, dan carpenter