From patchwork Mon May 13 13:55:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miao Xie X-Patchwork-Id: 2558941 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 2FBD93FD4E for ; Mon, 13 May 2013 15:12:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751643Ab3EMPMc (ORCPT ); Mon, 13 May 2013 11:12:32 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:28138 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751368Ab3EMPMa (ORCPT ); Mon, 13 May 2013 11:12:30 -0400 X-IronPort-AV: E=Sophos;i="4.87,663,1363104000"; d="scan'208";a="7257663" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 13 May 2013 23:09:35 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r4DDtVRn019983; Mon, 13 May 2013 21:55:32 +0800 Received: from btrfs.fnst.cn.fujitsu.com ([10.167.234.170]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013051321542813-1193734 ; Mon, 13 May 2013 21:54:28 +0800 From: Miao Xie To: linux-btrfs@vger.kernel.org Cc: Miao Xie , Tsutomu Itoh Subject: [PATCH 4/5] Btrfs: don't steal the reserved space from the global reserve if their space type is different Date: Mon, 13 May 2013 21:55:11 +0800 Message-Id: <1368453312-7027-4-git-send-email-miaox@cn.fujitsu.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1368453312-7027-1-git-send-email-miaox@cn.fujitsu.com> References: <1368453312-7027-1-git-send-email-miaox@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/05/13 21:54:28, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/05/13 21:54:29, Serialize complete at 2013/05/13 21:54:29 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org If the type of the space we need is different with the global reserve, we can not steal the space from the global reserve, because we can not allocate the space from the free space cache that the global reserve points to. Cc: Tsutomu Itoh Signed-off-by: Miao Xie --- fs/btrfs/extent-tree.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index e34e268..c48e1bd 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -6684,9 +6684,11 @@ try_reserve: return block_rsv; /* * If we couldn't reserve metadata bytes try and use some from - * the global reserve. + * the global reserve if its space type is the same as the global + * reservation. */ - if (block_rsv->type != BTRFS_BLOCK_RSV_GLOBAL) { + if (block_rsv->type != BTRFS_BLOCK_RSV_GLOBAL && + block_rsv->space_info == global_rsv->space_info) { ret = block_rsv_use_bytes(global_rsv, blocksize); if (!ret) return global_rsv;