From patchwork Tue Aug 17 02:57:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Rientjes X-Patchwork-Id: 119848 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7H2xJTM023213 for ; Tue, 17 Aug 2010 02:59:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755326Ab0HQC6B (ORCPT ); Mon, 16 Aug 2010 22:58:01 -0400 Received: from smtp-out.google.com ([216.239.44.51]:10769 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755255Ab0HQC57 (ORCPT ); Mon, 16 Aug 2010 22:57:59 -0400 Received: from wpaz33.hot.corp.google.com (wpaz33.hot.corp.google.com [172.24.198.97]) by smtp-out.google.com with ESMTP id o7H2vxjZ013668; Mon, 16 Aug 2010 19:57:59 -0700 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1282013879; bh=fBMhjLrw14su9njyHqD3wnj/xJM=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=LrqFs+EGYQBrff38NSzcxDAWrUB3qJh/ikTQOhfwNcOksJlbY/NIQROMEGrwnkZYp DoKuirs7Tt7hpyKsEANRA== DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=date:from:x-x-sender:to:cc:subject:in-reply-to:message-id: references:user-agent:mime-version:content-type:x-system-of-record; b=nq5Fcw3nW1VCduRZ8V53No2fyAXo3dILvAmr2IOkEERganK5k/KVh9TMTO9wCbwsT /g1fJSyAkFMGNVwOky9tQ== Received: from pxi3 (pxi3.prod.google.com [10.243.27.3]) by wpaz33.hot.corp.google.com with ESMTP id o7H2vtoN025942; Mon, 16 Aug 2010 19:57:57 -0700 Received: by pxi3 with SMTP id 3so3041147pxi.35 for ; Mon, 16 Aug 2010 19:57:57 -0700 (PDT) Received: by 10.114.74.19 with SMTP id w19mr7172157waa.143.1282013877331; Mon, 16 Aug 2010 19:57:57 -0700 (PDT) Received: from chino.kir.corp.google.com (chino.kir.corp.google.com [172.31.6.12]) by mx.google.com with ESMTPS id q6sm13382353waj.10.2010.08.16.19.57.55 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 16 Aug 2010 19:57:56 -0700 (PDT) Date: Mon, 16 Aug 2010 19:57:55 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Chris Mason cc: Andrew Morton , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [patch 2/6] btrfs: remove dependency on __GFP_NOFAIL In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 X-System-Of-Record: true 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]); Tue, 17 Aug 2010 02:59:19 +0000 (UTC) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3822,6 +3822,8 @@ static int update_block_group(struct btrfs_trans_handle *trans, spin_unlock(&cache->lock); spin_unlock(&cache->space_info->lock); } else { + int err; + old_val -= num_bytes; btrfs_set_block_group_used(&cache->item, old_val); cache->pinned += num_bytes; @@ -3831,9 +3833,12 @@ static int update_block_group(struct btrfs_trans_handle *trans, spin_unlock(&cache->lock); spin_unlock(&cache->space_info->lock); - set_extent_dirty(info->pinned_extents, + do { + /* FIXME: this may potentially loop forever */ + err = set_extent_dirty(info->pinned_extents, bytenr, bytenr + num_bytes - 1, - GFP_NOFS | __GFP_NOFAIL); + GFP_NOFS); + } while (err); } btrfs_put_block_group(cache); total -= num_bytes; @@ -3861,6 +3866,8 @@ static int pin_down_extent(struct btrfs_root *root, struct btrfs_block_group_cache *cache, u64 bytenr, u64 num_bytes, int reserved) { + int err; + spin_lock(&cache->space_info->lock); spin_lock(&cache->lock); cache->pinned += num_bytes; @@ -3872,8 +3879,11 @@ static int pin_down_extent(struct btrfs_root *root, spin_unlock(&cache->lock); spin_unlock(&cache->space_info->lock); - set_extent_dirty(root->fs_info->pinned_extents, bytenr, - bytenr + num_bytes - 1, GFP_NOFS | __GFP_NOFAIL); + do { + /* FIXME: this may potentially loop forever */ + err = set_extent_dirty(root->fs_info->pinned_extents, bytenr, + bytenr + num_bytes - 1, GFP_NOFS); + } while (err); return 0; } diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1967,7 +1967,10 @@ void btrfs_add_delayed_iput(struct inode *inode) if (atomic_add_unless(&inode->i_count, -1, 1)) return; - delayed = kmalloc(sizeof(*delayed), GFP_NOFS | __GFP_NOFAIL); + do { + /* FIXME: this may potentially loop forever */ + delayed = kmalloc(sizeof(*delayed), GFP_NOFS); + } while (!delayed); delayed->inode = inode; spin_lock(&fs_info->delayed_iput_lock);