From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Snook Subject: [RFC PATCH 0/2] avoid clobbering registers with J_ASSERT macro Date: Fri, 17 Aug 2007 01:54:18 -0400 Message-ID: <46C5380A.8080109@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, Chris Snook To: Stephen Tweedie , Andrew Morton Return-path: Received: from mx1.redhat.com ([66.187.233.31]:54526 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757713AbXHQFyX (ORCPT ); Fri, 17 Aug 2007 01:54:23 -0400 Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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. -- Chris