From patchwork Thu Sep 6 06:41:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Sheng-Hui X-Patchwork-Id: 1412211 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 9A7CA3FC71 for ; Thu, 6 Sep 2012 06:41:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753187Ab2IFGlL (ORCPT ); Thu, 6 Sep 2012 02:41:11 -0400 Received: from mail-ie0-f174.google.com ([209.85.223.174]:42730 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751799Ab2IFGlI (ORCPT ); Thu, 6 Sep 2012 02:41:08 -0400 Received: by mail-ie0-f174.google.com with SMTP id e11so2493083iej.19 for ; Wed, 05 Sep 2012 23:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=cydPPXWCfONrbtDBQIRkoP1YQLvhULeTxMq24vYChJA=; b=jlRJqx1Df456bvlUa1CvvgXjsOp+b0kC7rRc8y6b/AQ9Eg7QEJ+MqlrRmGnkKmNIaQ 7DRmYDjVnCS29vzN8xmVsuANk2iw5NDLPL/xGzYi/RK81J5Bp1zgon0aW4ttgQHmuihz cg8Mfj2R+t+FD2jnj9t8WzJ60x1sOcFHuumonLvQAvdaPKZTAVGHCFTU5F3/dKXl3g59 rIdbqZ9rxjrtVKy0sEWnTiLqyD5Maa1ikOSsF/VB7i+30fZFaILXZCXhG4iua+Dhuq6F NnSj0TKSVDsrtWODNtM1aJi81Htp1IllLogx11A4jPWbW0xv/K65jGydq7cmhopqlhsw k5OA== Received: by 10.50.89.169 with SMTP id bp9mr20938135igb.59.1346913667697; Wed, 05 Sep 2012 23:41:07 -0700 (PDT) Received: from [192.168.1.102] ([122.70.1.251]) by mx.google.com with ESMTPS id ff4sm3329811igc.5.2012.09.05.23.41.05 (version=SSLv3 cipher=OTHER); Wed, 05 Sep 2012 23:41:06 -0700 (PDT) Message-ID: <5048457E.6050002@gmail.com> Date: Thu, 06 Sep 2012 14:41:02 +0800 From: Wang Sheng-Hui User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11 MIME-Version: 1.0 To: chris.mason@fusionio.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] btrfs: remove unnecessary -ENOMEM BUG_ON check in extent-tree.c/btrfs_alloc_logged_file_extent Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The memory allocation failure is BUG_ON in add_excluded_extent (following the code path). No need to BUG_ON -ENOMEM inside btrfs_alloc_logged_file_extent. Signed-off-by: Wang Sheng-Hui --- fs/btrfs/extent-tree.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 95492cc..9b9a6fa 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -6207,8 +6207,7 @@ int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans, mutex_lock(&caching_ctl->mutex); if (start >= caching_ctl->progress) { - ret = add_excluded_extent(root, start, num_bytes); - BUG_ON(ret); /* -ENOMEM */ + add_excluded_extent(root, start, num_bytes); } else if (start + num_bytes <= caching_ctl->progress) { ret = btrfs_remove_free_space(block_group, start, num_bytes); @@ -6222,8 +6221,7 @@ int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans, start = caching_ctl->progress; num_bytes = ins->objectid + ins->offset - caching_ctl->progress; - ret = add_excluded_extent(root, start, num_bytes); - BUG_ON(ret); /* -ENOMEM */ + add_excluded_extent(root, start, num_bytes); } mutex_unlock(&caching_ctl->mutex);