Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp634554pxb; Fri, 15 Oct 2021 12:40:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiRGSh4pu949orRTbNK4pYt06y35Hy9/cLdAGGdBlcjQJ3ZM6yHXqB6tjrBbxyaajbLmyD X-Received: by 2002:a17:90a:b795:: with SMTP id m21mr15678427pjr.143.1634326846104; Fri, 15 Oct 2021 12:40:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634326846; cv=none; d=google.com; s=arc-20160816; b=xF1X31ZxCKfMUHfr2pFeZcMnX7L9TksJoLAqWIIhLzdunsDFHzl7I02IYNzqFuBlQV JcI2HpO0Np4gtLwrjzyxMbG4/aYkAqtzsrUt8n+GqCwgC6vKi4uJ821RVPQsGpANDXEy mfXfFiLlzBlyy7h6b+F7VZYcE5hHoAwWwDlFw9Cc+DTgyWyIC7qdhXp7eUpcOKNJTuF+ owsmDdGyP5Gg22pcGyJv9pbH3x2a3ERPT+QVoyWoZjsUQ1PaSZXew9D5TbHl0GVDX4OA 67dXPxjExd155ADM8stQ9tiUZq6YflgJzcoiv/7EIw0F5vlvMK4lc8mCqtQubRbe/OpW depA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:mail-followup-to:reply-to:message-id :subject:cc:to:from:date:dkim-signature:dkim-signature; bh=HD4Naw6zVJYU4sSXF2lgHK4ySkSIpgjUG3OcgSlUH9k=; b=h3FoEDH3LlhkepbqQqqx9XklkN9ikVw7Qw9CE4vrWoWP7lRdMINYUiGDH5W4deneSd 2zfuNRXBPhGf6XPy5xcMGHyl4+qyebJKx2zhVZ9mhshPQfa1nu4PO9+JU8G2YUWLAnj+ 2rWrT3sPE+CAexe8CrTzDfxgdZiBWnxRz8l42N1djQxvNXfcXaSIQz+5ZtjeMQrlw+Xq dwHHC7ej51mO+BS4WFXpGa7lEu40iQQUDn62oigKZHsi48hggfOOn7CRve7CWz2BsPye woylyU4IP69EKoeif++RGBCE9K93SlsET3g6ykZxSvXNgpfH9Flmz2v75ThxGW/Pm+2p 7big== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=UAaR7vTx; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i6si10455173plr.36.2021.10.15.12.40.33; Fri, 15 Oct 2021 12:40:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=UAaR7vTx; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238167AbhJOKy1 (ORCPT + 99 others); Fri, 15 Oct 2021 06:54:27 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:45920 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238122AbhJOKy1 (ORCPT ); Fri, 15 Oct 2021 06:54:27 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 060F21FD4B; Fri, 15 Oct 2021 10:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1634295140; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HD4Naw6zVJYU4sSXF2lgHK4ySkSIpgjUG3OcgSlUH9k=; b=UAaR7vTxFfMZs8kw63KTvtCFkD8S+XDQwU1N1BNcV0QRJR26XCrK7HSyXucmFNFtGnvL/b 8Zw+f/+YKKVh/fCgyVPH+igVQ7DHKf9PUziKcT2+Z0PpnDh8nW6stEM1XrWtwsAZ6myYjh Y10xyRVeWAHTN0D3aRpJ/hLYzPZddng= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1634295140; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HD4Naw6zVJYU4sSXF2lgHK4ySkSIpgjUG3OcgSlUH9k=; b=H/ONCZdwiM22D8kwNvHNuhfNAX7JRWpOLaS2Kc3/hxQLsyfmX14Q8C8MNLPABXKAXi9IzM EduCt4ZNduWB/iBA== Received: from ds.suse.cz (ds.suse.cz [10.100.12.205]) by relay2.suse.de (Postfix) with ESMTP id 913B8A3B81; Fri, 15 Oct 2021 10:52:19 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 68FFCDA7A3; Fri, 15 Oct 2021 12:51:54 +0200 (CEST) Date: Fri, 15 Oct 2021 12:51:54 +0200 From: David Sterba To: Wan Jiabing Cc: Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, kael_w@yeah.net, johannes.thumshirn@wdc.com Subject: Re: [PATCH] btrfs: Simplify conditional in assert Message-ID: <20211015105154.GC30611@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Wan Jiabing , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, kael_w@yeah.net, johannes.thumshirn@wdc.com References: <20211015103639.21838-1-wanjiabing@vivo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211015103639.21838-1-wanjiabing@vivo.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding Johannes to CC, On Fri, Oct 15, 2021 at 06:36:39AM -0400, Wan Jiabing wrote: > Fix following coccicheck warning: > ./fs/btrfs/inode.c:2015:16-18: WARNING !A || A && B is equivalent to !A || B > > Signed-off-by: Wan Jiabing > --- > fs/btrfs/inode.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c > index e9154b436c47..da4aeef73b0d 100644 > --- a/fs/btrfs/inode.c > +++ b/fs/btrfs/inode.c > @@ -2011,8 +2011,7 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_page > * to use run_delalloc_nocow() here, like for regular > * preallocated inodes. > */ > - ASSERT(!zoned || > - (zoned && btrfs_is_data_reloc_root(inode->root))); > + ASSERT(!zoned || btrfs_is_data_reloc_root(inode->root)); The short form is equivalent, but I'm not sure it's also on the same level of readability. Repeating the 'zoned' condition check makes it obvious on first sight, which is what I'd prefer. Johannes if you'd like the new version I'll change it but otherwise I'm fine with what we have now. > ret = run_delalloc_nocow(inode, locked_page, start, end, > page_started, nr_written); > } else if (!inode_can_compress(inode) || > -- > 2.20.1