Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754305AbYBQR4S (ORCPT ); Sun, 17 Feb 2008 12:56:18 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750920AbYBQR4A (ORCPT ); Sun, 17 Feb 2008 12:56:00 -0500 Received: from mgw1.diku.dk ([130.225.96.91]:58958 "EHLO mgw1.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750807AbYBQRz7 (ORCPT ); Sun, 17 Feb 2008 12:55:59 -0500 Date: Sun, 17 Feb 2008 18:55:49 +0100 (CET) From: Julia Lawall To: mark.fasheh@oracle.com, kurt.hackel@oracle.com, ocfs2-devel@oss.oracle.com, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 3/7] fs/ocfs2: Use BUG_ON Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1676 Lines: 63 From: Julia Lawall if (...) BUG(); should be replaced with BUG_ON(...) when the test has no side-effects to allow a definition of BUG_ON that drops the code completely. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @ disable unlikely @ expression E,f; @@ ( if (<... f(...) ...>) { BUG(); } | - if (unlikely(E)) { BUG(); } + BUG_ON(E); ) @@ expression E,f; @@ ( if (<... f(...) ...>) { BUG(); } | - if (E) { BUG(); } + BUG_ON(E); ) // Signed-off-by: Julia Lawall --- diff -u -p a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c --- a/fs/ocfs2/alloc.c 2008-02-05 20:56:02.000000000 +0100 +++ b/fs/ocfs2/alloc.c 2008-02-17 16:40:41.000000000 +0100 @@ -1029,8 +1029,7 @@ static void ocfs2_rotate_leaf(struct ocf BUG_ON(!next_free); /* The tree code before us didn't allow enough room in the leaf. */ - if (el->l_next_free_rec == el->l_count && !has_empty) - BUG(); + BUG_ON(el->l_next_free_rec == el->l_count && !has_empty); /* * The easiest way to approach this is to just remove the diff -u -p a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c --- a/fs/ocfs2/journal.c 2008-02-02 16:09:08.000000000 +0100 +++ b/fs/ocfs2/journal.c 2008-02-17 16:40:59.000000000 +0100 @@ -586,8 +586,7 @@ int ocfs2_journal_load(struct ocfs2_jour mlog_entry_void(); - if (!journal) - BUG(); + BUG_ON(!journal); osb = journal->j_osb; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/