Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp29148pxb; Tue, 2 Feb 2021 21:41:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPAsrkSRr2Gu6xQ4JLLNOhiMhcjAYExllvxLT+Amq9EfwMLTJ4u6WIK/o2feIBhC8aPUWu X-Received: by 2002:a17:906:5e5a:: with SMTP id b26mr1489136eju.327.1612330879055; Tue, 02 Feb 2021 21:41:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612330879; cv=none; d=google.com; s=arc-20160816; b=AhLG1vkoSjhYLVrtYwItT/AVN3pie0QLKIUA+rId5PntgMwM7IDg6ikR0GOZDBJTMP wnrez5u+quowzlvBIirGI/d+VRs3EEOfvb0QZ4KlDe8i8xeM3Ew/brjStwdjd/goXsAn OM7A+yEsZdnFzTQ4+W9Nu3f85oOcyGTEGZEk0RFOTjuQjreSSeQ/ZWT1IhQQORwa9yNA /1O85XIihrZeTetcomhF4fZ7jpOn+oNfIFsLfnA7I/N3ZHolLkQrF2QNGQAnTtpdgejn tRYz0XXX/1xy/AS26iBALW5rtAwr3H+NKm082hyAJh887fwTPuIQuKuDEjA6+5jgoRR9 no6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=8T0VpjuUY9+wZyHqWsL1S0PXkVPM9fKTNG9E/LJ3xyA=; b=ZgD5Wh1tyRyzDWzKYLDkJveRHt81K+Bn4R62E4UMRwiwutBJiLes3DZbR0IHPqjeOE LzTvlwNeA0KlIaIWrdtQc4y+kYtD618htgZi3GbeMy5PO9o4bbuZVRoQVeqfyL+gt8Hg epNUuf+LbRF1/6SWtY/Jtx867NFrGI9b/N4qGZaZHHWr1TRu/kElk39lmXuG6sKqAcd4 1uiKSfMTG2BKYJV8YYL23UsCei8YKnvAiwttnEEHU7qElZGD3sLKGNmgpN8giIL/gCqY stdwsijVMFJ6tDNpjThh5dmyYrI7RYuAVLtyJH5oFy6U0GMuIiNkwFIlMFWpeTTb4w0E jhHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 l11si625633edb.238.2021.02.02.21.40.51; Tue, 02 Feb 2021 21:41:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229650AbhBCFkE (ORCPT + 99 others); Wed, 3 Feb 2021 00:40:04 -0500 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:51259 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229502AbhBCFkD (ORCPT ); Wed, 3 Feb 2021 00:40:03 -0500 Received: from cwcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 1135d3Oe004504 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 3 Feb 2021 00:39:04 -0500 Received: by cwcc.thunk.org (Postfix, from userid 15806) id 63F7215C39E2; Wed, 3 Feb 2021 00:39:03 -0500 (EST) Date: Wed, 3 Feb 2021 00:39:03 -0500 From: "Theodore Ts'o" To: Vinicius Tinti Cc: Christoph Hellwig , Andreas Dilger , Nathan Chancellor , Nick Desaulniers , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH v3] ext4: Enable code path when DX_DEBUG is set Message-ID: References: <20210202080508.GA3550351@infradead.org> <20210202162837.129631-1-viniciustinti@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210202162837.129631-1-viniciustinti@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Feb 02, 2021 at 04:28:37PM +0000, Vinicius Tinti wrote: > Clang with -Wunreachable-code-aggressive is being used to try to find > unreachable code that could cause potential bugs. There is no plan to > enable it by default. > > The following code was detected as unreachable: > > fs/ext4/namei.c:831:17: warning: code will never be executed > [-Wunreachable-code] > unsigned n = count - 1; > ^~~~~ > fs/ext4/namei.c:830:7: note: silence by adding parentheses to mark code as > explicitly dead > if (0) { // linear search cross check > ^ > /* DISABLES CODE */ ( ) > > This has been present since commit ac27a0ec112a ("[PATCH] ext4: initial > copy of files from ext3") and fs/ext3 had it present at the beginning of > git history. It has not been changed since. > > This patch moves the code to a new function `htree_rep_invariant_check` > which only performs the check when DX_DEBUG is set. This allows the > function to be used in other parts of the code. > > Suggestions from: Andreas, Christoph, Nathan, Nick and Ted. > > Signed-off-by: Vinicius Tinti Thanks, applied, although I rewrote the commit description: ext4: factor out htree rep invariant check This patch moves some debugging code which is used to validate the hash tree node when doing a binary search of an htree node into a separate function, which is disabled by default (since it is only used by developers when they are modifying the htree code paths). In addition to cleaning up the code to make it more maintainable, it silences a Clang compiler warning when -Wunreachable-code-aggressive is enabled. (There is no plan to enable this warning by default, since there it has far too many false positives; nevertheless, this commit reduces one of the many false positives by one.) The original description buried the lede, in terms of the primary reason why I think the change was worthwhile (although I know you have different priorities than mine :-). Thanks for working to find a way to improve the code in a way that makes both of us happy! - Ted