From patchwork Tue Oct 22 11:32:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 3082151 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3B25BBF924 for ; Tue, 22 Oct 2013 11:32:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9AA2220498 for ; Tue, 22 Oct 2013 11:32:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5674D20444 for ; Tue, 22 Oct 2013 11:32:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753076Ab3JVLcX (ORCPT ); Tue, 22 Oct 2013 07:32:23 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:50585 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751257Ab3JVLcU (ORCPT ); Tue, 22 Oct 2013 07:32:20 -0400 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r9MBWIY4030127 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 22 Oct 2013 11:32:19 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r9MBWHKI026753 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 22 Oct 2013 11:32:17 GMT Received: from abhmt116.oracle.com (abhmt116.oracle.com [141.146.116.68]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r9MBWHxC026748; Tue, 22 Oct 2013 11:32:17 GMT Received: from localhost.localdomain.localdomain (/222.91.101.17) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 22 Oct 2013 04:32:16 -0700 From: Liu Bo To: linux-btrfs@vger.kernel.org Cc: Dan Greene Subject: [RFC PATCH] Btrfs: do not relocate system chunk when building on seeding disk Date: Tue, 22 Oct 2013 19:32:04 +0800 Message-Id: <1382441524-17423-1-git-send-email-bo.li.liu@oracle.com> X-Mailer: git-send-email 1.8.1.4 X-Source-IP: acsinet21.oracle.com [141.146.126.237] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When we build btrfs on seeding disk, we simply add a disk to provide a RW disk while seeding disk remains RO, as the disk that we're adding is the first rw disk, we need to allocate new metadata chunk and system chunk on it for later udpate use. After all above is done, we don't need to relocate the system chunk again since the relocation even tries to find free space on the added disk, the same disk where we just create our metadata chunk and system chunk. Signed-off-by: Liu Bo --- fs/btrfs/volumes.c | 17 ----------------- 1 files changed, 0 insertions(+), 17 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 043b215..00f3779 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2112,23 +2112,6 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) if (seeding_dev) { mutex_unlock(&uuid_mutex); up_write(&sb->s_umount); - - if (ret) /* transaction commit */ - return ret; - - ret = btrfs_relocate_sys_chunks(root); - if (ret < 0) - btrfs_error(root->fs_info, ret, - "Failed to relocate sys chunks after " - "device initialization. This can be fixed " - "using the \"btrfs balance\" command."); - trans = btrfs_attach_transaction(root); - if (IS_ERR(trans)) { - if (PTR_ERR(trans) == -ENOENT) - return 0; - return PTR_ERR(trans); - } - ret = btrfs_commit_transaction(trans, root); } return ret;