Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2344911imm; Thu, 9 Aug 2018 11:13:53 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyW4m2tbNSpBcr3gCgj19dBRJy4T9W2WHqdt62YvaBVRVrg189PSMiveGEg6K07v2k3vEq8 X-Received: by 2002:a65:4541:: with SMTP id x1-v6mr3133962pgr.26.1533838433191; Thu, 09 Aug 2018 11:13:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533838433; cv=none; d=google.com; s=arc-20160816; b=W2HtQivptgkeFpZ7rvfrBrcO09a83SkTUiGzg1aPGF72hLXD85mXDPJ7aFzPXEWXky 6/zi4kquL1cp/jXgBLsFINm3GXZI8wMVm7d+rd43Gyi+dby+F0QAbTQHKq2yszR0x31Q 3gFzkGSX5y3d0/7hgxGyzccwSy9vIy8k+c1pIP43jPu2+LijZv8huvBAXvIKdSivN2JT 08oOlQxIzL5kGFUZrHajn39u75vdgBO0LSxCQRGn7QoM7Aww7PrUvvic89+cDGI7VoYv VuC23uvnRSFcHs5b2eXR0BwnHq98KckGQXFT5oJQ/zP/k4mpWfDwMCgqheECFxzZww9d wUIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=K9pEvg/1xtQMCMUm7eNfeyd82C7DFAaxfDmz/G7l5JI=; b=OuvKvXqFOjuCL6hgHUaxUDmNvlRjAD03i14Fc0a0CUBqiM17QZfw+wmf6tsQ325qD2 Twu60ygK+KhA0IchKiQx4dePWuVf2nS8uAF1dBSDgOF5yc3VYHviQeTULnksrM0sM+wU TLfzsBZH+tN0P2tM0lZ8nQmmaHA45ETGPCQk0xwKf2sljN45pZAH0tqtfpdTKnOa1Dev J0Kc82oHUO+5IQPIcV/hYpZcFvy4VYsmhQvyLJldiD5cBmeMwi8qcpxrsMmB/jbsTg6x BUkYTbrOZOuaNZ8uI+VF0hnaw+oo/g9QGonnda7zzM8SOXCHWYyXjSKLrqoOJaZudPa2 YiTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=lvhmBoUv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1-v6si7973023pfm.7.2018.08.09.11.13.38; Thu, 09 Aug 2018 11:13:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=lvhmBoUv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727611AbeHIUhm (ORCPT + 99 others); Thu, 9 Aug 2018 16:37:42 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:41401 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727537AbeHIUhk (ORCPT ); Thu, 9 Aug 2018 16:37:40 -0400 Received: by mail-pg1-f195.google.com with SMTP id z8-v6so3112964pgu.8; Thu, 09 Aug 2018 11:11:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=K9pEvg/1xtQMCMUm7eNfeyd82C7DFAaxfDmz/G7l5JI=; b=lvhmBoUvi1sgETLgmrkk5/eJG+QjX7O20Kipqn2vLQt1OaFSYGpF0I5Sok1tWryjmT ivKJvmWenEck4SeICntWYPAjfgXXfjMPV15a1hHUPvTlL5qX0sZ9JlYfR+3zVph8G0A4 JQ0wJr4ewwYUA7YAHaRZd8trcMbFCNY+bll1/FE/07yQ1OXFFMWb7N5e5A1bXJPQQY8j aS+YSYNZhbe1TfuwRh5GVmQKmSwxY3Lxkn0I1xzDZ7Q5tVk6SHB/p6LGEKmOHZJ1jRBL 91XzmtQPS2Vaw7wnt/hIHiEk1K2HjUhVQYozCxc9Wgon1FOwfIaiOfRIOCOicWY8Z55x 7kvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=K9pEvg/1xtQMCMUm7eNfeyd82C7DFAaxfDmz/G7l5JI=; b=QJ1e3rX6uzWnttnO+MSZYGJNZskSyHv8hgBMUKTHARB9mlw/+sEtt2+cN/i3lTAreT x+m8xdfLHCsUb24stLmFWAYsqjLKYixvdkpA9Gjgzr8RIndlhVpgnNMZswOdSfBNzbqU lzNptP1/r70Xb+KKCyxsprRw9uzUO0p/nLcjlzun2Bw0mz4jnzW1N/a9OdbqKj93XAqa IHsR3i4iNYm+Z24krnBcY107fqHb7RT+sS+L2WbR4ImBqIryEdk+CsLMtGCMqIMk4o9m +DS1Mz2cL0UK0wU2d+D7wnJtaIgR7M+/2L6QV3OUlkLo/Ao5uyND5XiRv9b8TDvGFmdS K7zg== X-Gm-Message-State: AOUpUlFPvOPlY8XePLT4eXC8AQg6lcpGDT1iKkjoVgik2dt9Zii1hBQ2 7tdr25IVa88DebBCkuOPjhw= X-Received: by 2002:a63:1360:: with SMTP id 32-v6mr3200393pgt.159.1533838298870; Thu, 09 Aug 2018 11:11:38 -0700 (PDT) Received: from localhost (h101-111-148-072.catv02.itscom.jp. [101.111.148.72]) by smtp.gmail.com with ESMTPSA id t12-v6sm14913273pgg.72.2018.08.09.11.11.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 11:11:38 -0700 (PDT) From: Naohiro Aota To: David Sterba , linux-btrfs@vger.kernel.org Cc: Chris Mason , Josef Bacik , linux-kernel@vger.kernel.org, Hannes Reinecke , Damien Le Moal , Bart Van Assche , Matias Bjorling , Naohiro Aota Subject: [RFC PATCH 11/12] btrfs-progs: replace: disable in HMZONED device Date: Fri, 10 Aug 2018 03:11:04 +0900 Message-Id: <20180809181105.12856-11-naota@elisp.net> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180809181105.12856-1-naota@elisp.net> References: <20180809180450.5091-1-naota@elisp.net> <20180809181105.12856-1-naota@elisp.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As show in the kernel patches, device replace feature needs more works to complete. Disable the feature for now. Signed-off-by: Naohiro Aota --- cmds-replace.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cmds-replace.c b/cmds-replace.c index 1fa80284..642fbd4b 100644 --- a/cmds-replace.c +++ b/cmds-replace.c @@ -116,6 +116,7 @@ static const char *const cmd_replace_start_usage[] = { static int cmd_replace_start(int argc, char **argv) { + struct btrfs_ioctl_feature_flags feature_flags; struct btrfs_ioctl_dev_replace_args start_args = {0}; struct btrfs_ioctl_dev_replace_args status_args = {0}; int ret; @@ -123,6 +124,7 @@ static int cmd_replace_start(int argc, char **argv) int c; int fdmnt = -1; int fddstdev = -1; + int hmzoned; char *path; char *srcdev; char *dstdev = NULL; @@ -200,6 +202,13 @@ static int cmd_replace_start(int argc, char **argv) goto leave_with_error; } + ret = ioctl(fdmnt, BTRFS_IOC_GET_FEATURES, &feature_flags); + if (ret) { + error("error getting feature flags '%s': %m", path); + return 1; + } + hmzoned = feature_flags.incompat_flags & BTRFS_FEATURE_INCOMPAT_HMZONED; + if (string_is_numerical(srcdev)) { struct btrfs_ioctl_fs_info_args fi_args; struct btrfs_ioctl_dev_info_args *di_args = NULL; @@ -238,6 +247,12 @@ static int cmd_replace_start(int argc, char **argv) goto leave_with_error; } + if (hmzoned) { + error("cannot replace device on HMZONED file system '%s'", + dstdev); + goto leave_with_error; + } + ret = test_dev_for_mkfs(dstdev, force_using_targetdev); if (ret) goto leave_with_error; -- 2.18.0