Re: [PATCH v2] ext4: Enable code path when DX_DEBUG is set

From: Christoph Hellwig
Date: Tue Feb 02 2021 - 03:06:14 EST


On Mon, Feb 01, 2021 at 12:13:52PM -0500, Theodore Ts'o wrote:
> 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.

Yes. The problem with a non-Kconfig ifdef is that is is almost
guaranteed to bitrot very fast, so you might as well just remove the
code. The "if (0)", while ugly, at least ensures the code still
actually is seen and checked by the compiler.