From patchwork Mon Dec 20 15:41:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Mason X-Patchwork-Id: 421341 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBKFfmV1032177 for ; Mon, 20 Dec 2010 15:41:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757923Ab0LTPlq (ORCPT ); Mon, 20 Dec 2010 10:41:46 -0500 Received: from rcsinet10.oracle.com ([148.87.113.121]:62810 "EHLO rcsinet10.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757897Ab0LTPlp (ORCPT ); Mon, 20 Dec 2010 10:41:45 -0500 Received: from rcsinet13.oracle.com (rcsinet13.oracle.com [148.87.113.125]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id oBKFfXHD016810 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 20 Dec 2010 15:41:34 GMT Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by rcsinet13.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id oBKFfVln002828; Mon, 20 Dec 2010 15:41:31 GMT Received: from abhmt010.oracle.com by acsmt355.oracle.com with ESMTP id 890055991292859683; Mon, 20 Dec 2010 07:41:23 -0800 Received: from localhost (/66.66.148.185) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 20 Dec 2010 07:41:22 -0800 From: Chris Mason To: miaox Cc: Linux Btrfs , "Yan, Zheng" Subject: Re: [BUG] can not allocate space for caching data In-reply-to: <4D0F566A.2020103@cn.fujitsu.com> References: <4D0F4B26.7030406@cn.fujitsu.com> <1292848998-sup-5155@think> <4D0F566A.2020103@cn.fujitsu.com> Date: Mon, 20 Dec 2010 10:41:17 -0500 Message-Id: <1292859261-sup-570@think> User-Agent: Sup/git 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 (demeter1.kernel.org [140.211.167.41]); Mon, 20 Dec 2010 15:41:50 +0000 (UTC) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 227e581..6f7d758 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -7970,13 +7970,14 @@ static int set_block_group_ro(struct btrfs_block_group_cache *cache) if (sinfo->bytes_used + sinfo->bytes_reserved + sinfo->bytes_pinned + sinfo->bytes_may_use + sinfo->bytes_readonly + - cache->reserved_pinned + num_bytes < sinfo->total_bytes) { + cache->reserved_pinned + num_bytes <= sinfo->total_bytes) { sinfo->bytes_readonly += num_bytes; sinfo->bytes_reserved += cache->reserved_pinned; cache->reserved_pinned = 0; cache->ro = 1; ret = 0; } + spin_unlock(&cache->lock); spin_unlock(&sinfo->lock); return ret;