From patchwork Wed Apr 28 11:50:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Samuel X-Patchwork-Id: 95660 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3SBpEWO027201 for ; Wed, 28 Apr 2010 11:51:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753461Ab0D1LvN (ORCPT ); Wed, 28 Apr 2010 07:51:13 -0400 Received: from csamuel.org ([74.50.50.137]:36779 "EHLO csamuel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752095Ab0D1LvM (ORCPT ); Wed, 28 Apr 2010 07:51:12 -0400 Received: from localhost (localhost [127.0.0.1]) by csamuel.org (Postfix) with ESMTP id 6FB8A405B6 for ; Wed, 28 Apr 2010 21:51:12 +1000 (EST) Received: from csamuel.org ([127.0.0.1]) by localhost (csamuel.org [127.0.0.1]) (amavisd-maia, port 10024) with LMTP id 07294-01 for ; Wed, 28 Apr 2010 21:51:12 +1000 (EST) Received: from [10.2.74.233] (72-255-2-155.client.stsn.net [72.255.2.155]) by csamuel.org (Postfix) with ESMTPSA id DBCFA405AC for ; Wed, 28 Apr 2010 21:51:11 +1000 (EST) Message-ID: <4BD82120.4030008@csamuel.org> Date: Wed, 28 Apr 2010 07:50:56 -0400 From: Chris Samuel User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100423 Lightning/1.0b1 Thunderbird/3.0.4 MIME-Version: 1.0 To: linux-btrfs@vger.kernel.org Subject: [PATCH] [Coccinelle] Convert various if() BUG(); to BUG_ON(); Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 28 Apr 2010 11:51:15 +0000 (UTC) diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 6795a71..8f6491f 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -1178,9 +1178,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, } /* double check we haven't messed things up */ check_block(root, path, level); - if (orig_ptr != - btrfs_node_blockptr(path->nodes[level], path->slots[level])) - BUG(); + BUG_ON(orig_ptr != btrfs_node_blockptr(path->nodes[level], path->slots[level])); enospc: if (right) { btrfs_tree_unlock(right); @@ -2137,8 +2135,7 @@ static int insert_ptr(struct btrfs_trans_handle *trans, struct btrfs_root lower = path->nodes[level]; nritems = btrfs_header_nritems(lower); BUG_ON(slot > nritems); - if (nritems == BTRFS_NODEPTRS_PER_BLOCK(root)) - BUG(); + BUG_ON(nritems == BTRFS_NODEPTRS_PER_BLOCK(root)); if (slot != nritems) { memmove_extent_buffer(lower, btrfs_node_key_ptr_offset(slot + 1), diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c index 0d126be..2d5e1d9 100644 --- a/fs/btrfs/print-tree.c +++ b/fs/btrfs/print-tree.c @@ -325,12 +325,8 @@ void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *c) btrfs_node_blockptr(c, i), btrfs_level_size(root, level - 1), btrfs_node_ptr_generation(c, i)); - if (btrfs_is_leaf(next) && - level != 1) - BUG(); - if (btrfs_header_level(next) != - level - 1) - BUG(); + BUG_ON(btrfs_is_leaf(next) && level != 1); + BUG_ON(btrfs_header_level(next) != level - 1); btrfs_print_tree(root, next); free_extent_buffer(next); } diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index af57dd2..7a55957 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -375,9 +375,7 @@ insert: item_size - found_size); BUG_ON(ret); } - } else if (ret) { - BUG(); - } + } else BUG_ON(ret); dst_ptr = btrfs_item_ptr_offset(path->nodes[0], path->slots[0]); diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 8db7b14..480edee 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1860,8 +1860,7 @@ again: found_key.offset); if (ret == -ENOSPC) failed++; - else if (ret) - BUG(); + else BUG_ON(ret); } if (found_key.offset == 0)