From patchwork Sun Jun 7 09:44:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 6561161 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 23B719F3E6 for ; Sun, 7 Jun 2015 11:10:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D807204B0 for ; Sun, 7 Jun 2015 11:10:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 32494205CD for ; Sun, 7 Jun 2015 11:10:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752989AbbFGLID (ORCPT ); Sun, 7 Jun 2015 07:08:03 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:43707 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751583AbbFGLIB (ORCPT ); Sun, 7 Jun 2015 07:08:01 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t57B7wXr003759 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 7 Jun 2015 11:07:59 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t57B7wXb006470 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sun, 7 Jun 2015 11:07:58 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t57B7wX5008128; Sun, 7 Jun 2015 11:07:58 GMT Received: from localhost.localdomain (/117.235.32.6) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 07 Jun 2015 04:07:58 -0700 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz Subject: [PATCH] Btrfs: sysfs support for the replace of the seed device Date: Sun, 7 Jun 2015 17:44:32 +0800 Message-Id: <1433670272-1563-2-git-send-email-anand.jain@oracle.com> X-Mailer: git-send-email 2.4.1 In-Reply-To: <1433670272-1563-1-git-send-email-anand.jain@oracle.com> References: <1433670272-1563-1-git-send-email-anand.jain@oracle.com> X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Earlier as reported "replace seed/sprout hangs (regression ?)" and since now I don't see that regression, was able to test this scenario. And thus added the support in the sysfs. Test case mount seed device add sprout replace seed device (so now sprout fs is independent of seed fs) The sysfs layout should change accordingly. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index a6a2b84..5a6f732 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -585,7 +585,11 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, /* replace the sysfs entry */ btrfs_sysfs_rm_device_link(fs_info->fs_devices, src_device, 0); - btrfs_sysfs_rm_device_attr(src_device); + if (src_device->fs_devices->seeding && + !src_device->fs_devices->num_devices) + btrfs_sysfs_remove_fsid(src_device->fs_devices); + else + btrfs_sysfs_rm_device_attr(src_device); btrfs_rm_dev_replace_free_srcdev(fs_info, src_device); /* write back the superblocks */