From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [RFC PATCH 0/2] avoid clobbering registers with J_ASSERT macro Date: Fri, 17 Aug 2007 13:54:02 -0700 Message-ID: <20070817135402.d7246766.akpm@linux-foundation.org> References: <46C5380A.8080109@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Stephen Tweedie , linux-fsdevel@vger.kernel.org To: Chris Snook Return-path: Received: from smtp2.linux-foundation.org ([207.189.120.14]:42151 "EHLO smtp2.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753484AbXHQUyq (ORCPT ); Fri, 17 Aug 2007 16:54:46 -0400 In-Reply-To: <46C5380A.8080109@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Fri, 17 Aug 2007 01:54:18 -0400 Chris Snook wrote: > The J_ASSERT() macro in jbd and jbd2 calls printk() prior to BUG(). While this > makes it more convenient to read the assertion failure, it also clobbers > registers, which can sometimes make debugging harder, which is clearly not the > intended purpose. I recently banged my head on this myself. > > The following patches to jbd and jbd2 enable the printk only if > CONFIG_JBD[2]_DEBUG is set. Otherwise, it will simply BUG if the condition is > violated. This way test kernels still get the benefit of the J_ASSERT printk, > while production kernels, which come from a more stable source base where it's > easier to trace line numbers back to specific lines of code, simply get the BUG, > with all registers preserved. > > This is, of course, not the only way of fixing this problem, but it seems to be > the least invasive way, which is why I'm proposing these patches. How's about we just remove that printk? Do #define J_ASSERT(e) BUG_ON(e)? The rest of the kernel seems to be able to cope with that...