Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3976365pxb; Mon, 1 Feb 2021 09:16:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxaA1HtTikXJCc2oZgp6925zJLjnteEt9tp8sOL3y9ZKQRLmhrhKHD6brdUT26w6Ls4W5er X-Received: by 2002:aa7:c895:: with SMTP id p21mr19817078eds.165.1612199777501; Mon, 01 Feb 2021 09:16:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612199777; cv=none; d=google.com; s=arc-20160816; b=Lh/mFwQ3oH8Yh7gFLI5TPLBdqjUS9um949HnsJo5ZA1GDilg3Jm/qqewMNNQiWNphs OmE4kUytHMmdc9IB+JMOL7JAo18L96/RuL2k32gBjH+XW8zO4RGIgJDI+thzLTFXT0a9 Ad6x291bVvA1+BrdtN9wTaoJBkDzPPQSUhmRXGzVkkmKEaWF1A2NpLQE8aUVg8xn8wZp QYcr16rUUvB2zGuWo1Wn3zQLOYtGycwaiMRuS8eVwlhsTrbFA2TaOSKupEwS+8cLC87a F6qg6hAs1TE//gJzBEEkrCAr7FKR1MEQYygUjCZE6eDPb4eZifqs+bL8ZxlvcbpjcPgn W7vQ== 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=YNvBd7o3JQWV3Sz+1sbOk6eCXwdJ9hr918I+tZWrXWA=; b=o/DO6Za7qiQ5KvO0uoDA5oE+V2XATbPUuCPFly0t3RMQw2KRgkOgSTpPddGh9JfXYf FFT9hMHiQodObUzoabdNLZHOlRfUH2qq5zIHAZvzK+QjyZtujCK6aSIf4+UInw3PBKG2 rmwhOCMt3W5cCm2jg7tUUMGvoCNmvljfbfKndtEOUPUwd9s0H0EV61/3+F9bMfKxJDzq 1vfsOV2cHJDQV6HMN4ISM1d35UXtOnsGR0QzUFhhHUyHQhZ80fW/klZQQ8k0sulprm/h P0C2+pOKQaVKKcgXSDbRw8gcWSLiV8TQD5HfP2LjeuhyoPfOqfUtzQFL5Gnjj0IYWxK9 uG4w== ARC-Authentication-Results: i=1; mx.google.com; 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 hs23si9980125ejc.26.2021.02.01.09.15.48; Mon, 01 Feb 2021 09:16:17 -0800 (PST) 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; 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 S231284AbhBAROs (ORCPT + 99 others); Mon, 1 Feb 2021 12:14:48 -0500 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:57567 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229612AbhBAROp (ORCPT ); Mon, 1 Feb 2021 12:14:45 -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 111HDqQK007142 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 1 Feb 2021 12:13:52 -0500 Received: by cwcc.thunk.org (Postfix, from userid 15806) id 2C3B615C39D9; Mon, 1 Feb 2021 12:13:52 -0500 (EST) Date: Mon, 1 Feb 2021 12:13:52 -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 v2] ext4: Enable code path when DX_DEBUG is set Message-ID: References: <20210201003125.90257-1-viniciustinti@gmail.com> <20210201124924.GA3284018@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 01, 2021 at 01:15:29PM -0300, Vinicius Tinti wrote: > On Mon, Feb 1, 2021 at 9:49 AM Christoph Hellwig wrote: > > > > DX_DEBUG is completely dead code, so either kill it off or make it an > > actual CONFIG_* symbol through Kconfig if it seems useful. > > About the unreachable code in "if (0)" I think it could be removed. > It seems to be doing an extra check. > > About the DX_DEBUG I think I can do another patch adding it to Kconfig > as you and Nathan suggested. Yes, it's doing another check which is useful in terms of early detection of bugs when a developer has the code open for modifications. It slows down performance under normal circumstances, and assuming the code is bug-free(tm), it's entirely unnecessary --- which is why it's under an "if (0)". However, if there *is* a bug, having an early detection that the representation invariant of the data structure has been violated can be useful in root causing a bug. This would probably be clearer if the code was pulled out into a separate function with comments explaining that this is a rep invariant check. The main thing about DX_DEBUG right now is that it is **super** verbose. Unwary users who enable it.... will be sorry. If we want to make it to be a first-class feature enabled via CONFIG_EXT4_DEBUG, we should convert all of the dx_trace calls to use pr_debug so they are enabled only if dynamic debug enables those pr_debug() statements. And this should absolutely be a separate patch. Cheers, - Ted