From patchwork Fri May 27 01:26:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 9137551 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ADEA76075C for ; Fri, 27 May 2016 01:25:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9535727CEC for ; Fri, 27 May 2016 01:25:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88DF3282F7; Fri, 27 May 2016 01:25:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2809027CEC for ; Fri, 27 May 2016 01:25:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755893AbcE0BZQ (ORCPT ); Thu, 26 May 2016 21:25:16 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:46702 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755823AbcE0BZP (ORCPT ); Thu, 26 May 2016 21:25:15 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u4R1PA9Z032558 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 27 May 2016 01:25:11 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id u4R1PAY2009082 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 27 May 2016 01:25:10 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u4R1P94r010446; Fri, 27 May 2016 01:25:10 GMT Received: from localhost.us.oracle.com (/10.211.47.181) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 26 May 2016 18:25:09 -0700 From: Liu Bo To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz Subject: [PATCH 1/2] Btrfs-progs: make convert to allocate space from the desired type of block group Date: Thu, 26 May 2016 18:26:49 -0700 Message-Id: <1464312410-10999-1-git-send-email-bo.li.liu@oracle.com> X-Mailer: git-send-email 2.5.5 X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP During btrfs-convert, it can allocate space from METADATA block group for data, which is not supposed to be correct, although it doesn't cause any serious problem except eating METADATA space more quickly. Signed-off-by: Liu Bo --- btrfs-convert.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/btrfs-convert.c b/btrfs-convert.c index b49775c..550aa8f 100644 --- a/btrfs-convert.c +++ b/btrfs-convert.c @@ -364,6 +364,12 @@ static int custom_alloc_extent(struct btrfs_root *root, u64 num_bytes, continue; } + if ((!!metadata) != + (!!(cache->flags & BTRFS_BLOCK_GROUP_METADATA))) { + last = cache->key.objectid + cache->key.offset; + continue; + } + if (metadata) { BUG_ON(num_bytes != root->nodesize); if (check_crossing_stripes(start, num_bytes)) {