From patchwork Tue Jul 8 22:21:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: HIMANGI SARAOGI X-Patchwork-Id: 4510321 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A82B09F4BC for ; Tue, 8 Jul 2014 22:22:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 89CD22018E for ; Tue, 8 Jul 2014 22:22:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 556FE2016C for ; Tue, 8 Jul 2014 22:22:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751780AbaGHWVt (ORCPT ); Tue, 8 Jul 2014 18:21:49 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:48157 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751660AbaGHWVs (ORCPT ); Tue, 8 Jul 2014 18:21:48 -0400 Received: by mail-pd0-f175.google.com with SMTP id v10so7787270pde.6 for ; Tue, 08 Jul 2014 15:21:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=X06C89EGY+oSfLSYQjefQ9frB7xjNMTEXAuArWLQ4dM=; b=iT85LyV4674sfHpm17UvgQDfEQtoq0agVafAgdbI7pZ0/d9T+PvqU6mIs/oKjx5Wkf OsII3ePR5bpnTQ80E0DF2q3Q3zpuRGg+CmoMOhHBQnTzvkdFOBVBUaOcTmrEVCpb/ayp SewL1G/Ueu3jWeaK+erEDsQQa4P7PwPo8GUD2DX0ifJkHgTsYCSCV/dgTEXCk1Swt2of HQE/P0/xaH38+DcJKCWJiznBfU8V3X5TgEZz5oey1UCyMnIAiKCVcqhhk8WjSowG6uWh jwdBtO3UzsymCiEuz1fWjmqldDdFzBg7OyX1NdTA0uS+yrYyV6R6aOLf0gZf2N+k+lyj Szcg== X-Received: by 10.68.213.97 with SMTP id nr1mr37054888pbc.52.1404858107779; Tue, 08 Jul 2014 15:21:47 -0700 (PDT) Received: from localhost ([182.65.208.116]) by mx.google.com with ESMTPSA id rz4sm15192418pab.13.2014.07.08.15.21.44 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 08 Jul 2014 15:21:46 -0700 (PDT) Date: Wed, 9 Jul 2014 03:51:41 +0530 From: Himangi Saraogi To: Chris Mason , Josef Bacik , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Cc: julia.lawall@lip6.fr Subject: [PATCH] Btrfs: use BUG_ON Message-ID: <20140708222141.GA11854@himangi-Dell> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use BUG_ON(x) rather than if(x) BUG(); The semantic patch that fixes this problem is as follows: // @@ identifier x; @@ -if (x) BUG(); +BUG_ON(x); // Signed-off-by: Himangi Saraogi Acked-by: Julia Lawall --- fs/btrfs/volumes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 6104676..63e746e 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2623,8 +2623,8 @@ again: found_key.offset); if (ret == -ENOSPC) failed++; - else if (ret) - BUG(); + else + BUG_ON(ret); } if (found_key.offset == 0)