From patchwork Thu Apr 28 04:31:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 8965381 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C26CDBF29F for ; Thu, 28 Apr 2016 04:32:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CB720202D1 for ; Thu, 28 Apr 2016 04:32:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D3998202A1 for ; Thu, 28 Apr 2016 04:32:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750932AbcD1EcR (ORCPT ); Thu, 28 Apr 2016 00:32:17 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:33786 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750876AbcD1EcQ (ORCPT ); Thu, 28 Apr 2016 00:32:16 -0400 Received: by mail-pf0-f182.google.com with SMTP id 206so28878748pfu.0 for ; Wed, 27 Apr 2016 21:32:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=yU6ZPdTFUf6uIeADCvHPlCT/uHSzhxuv1D2VQV4SxpM=; b=gGVUvr0mYCS9iMDnOfZxXlQVs+WGYNd+dhyvsKAGgbXP+LvlZY8yhm3vQ+57V0EFcA zVYjafWTIVUtMoEMXGXcZD5zhMmfdZ9RLErns03h4CM5+xENdK30kdMqSVm2vzsq2yok VP1OBDY8RaSY7gLyrlWtjabcCHJFjVGPOU+lY8szjrYp8ICP3+yEyRIwTTMgjWyRAULe poGEsCEwcOgKRG/x4LBCW9//5ulEmgLR2cFPwlxGIIaTL3uABvP7HgBZZUOhAW3D7BF6 Y2qw9y4JBsfMXUFVzLVxVx4rGBadvlYPdxxyYrkUvBN+82aeFfQapq4TsW/t0s5UpN0Z ZL+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=yU6ZPdTFUf6uIeADCvHPlCT/uHSzhxuv1D2VQV4SxpM=; b=Jxk7Szyc3uL8kMeUXA/q4oy/qBik+iiBOlhAYGTEhLqSrCOvoD8QUZPf+nasVfBSLV QSrhYuIaJzqFle33OzTZCFM/sKptjGGfHqBlqSQAzOrsQqKwOTWxzbH2bGN4nMS68a0y 0CSdLuOhyxKuEleChwm/Kh7WoJ8lUikXKEZ/3mORbKpZv4/i5d83nYlAvLgDBvsfGT04 jwHrmHz549eKgFKfkjfpxDivh4zkVfA1cykiEVDC+q9oXCxnZ7pdH+v4bv8+zvOncBUL Kg7/RUAhZk6gj1TcHhPWAnplB+vN4NosOelM5P1jmqD12fbEpbu/WqkJKz9BlWnUgNVu Ksew== X-Gm-Message-State: AOPr4FVQv1V/mYLLosmJhfqcZRSpjOizRoamQmAq7Fjm2sFdNLkDbZ3yqhwfa2rvjDA20HEd X-Received: by 10.98.86.24 with SMTP id k24mr17332812pfb.87.1461817935508; Wed, 27 Apr 2016 21:32:15 -0700 (PDT) Received: from vader.localdomain ([2601:602:9501:1610:1a5e:fff:fea7:e0ef]) by smtp.gmail.com with ESMTPSA id 19sm10576696pfu.83.2016.04.27.21.32.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Apr 2016 21:32:14 -0700 (PDT) From: Omar Sandoval X-Google-Original-From: Omar Sandoval To: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org Cc: kernel-team@fb.com, Omar Sandoval Subject: [PATCH 1/2] btrfs: add replace missing and replace RAID 5/6 to profile configs Date: Wed, 27 Apr 2016 21:31:51 -0700 Message-Id: <3e66fa89bac8d7bf2e7ca1ca8e07229f8e567ae6.1461817486.git.osandov@fb.com> X-Mailer: git-send-email 2.8.0 In-Reply-To: References: In-Reply-To: References: Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 From: Omar Sandoval Replacing and scrubbing RAID 5/6 is now supported on Btrfs. Enable it in _btrfs_get_profile_configs while making it more generic to also support replace missing. Reviewed-by: Eryu Guan Signed-off-by: Omar Sandoval --- common/rc | 95 ++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/common/rc b/common/rc index 8bec836805c6..91e8f1c8e693 100644 --- a/common/rc +++ b/common/rc @@ -3207,60 +3207,61 @@ _btrfs_get_profile_configs() return fi - # no user specified btrfs profile configs, export the default configs if [ -z "$BTRFS_PROFILE_CONFIGS" ]; then - # default configs - _btrfs_profile_configs=( - "-m single -d single" - "-m dup -d single" - "-m raid0 -d raid0" - "-m raid1 -d raid0" - "-m raid1 -d raid1" - "-m raid10 -d raid10" - "-m raid5 -d raid5" - "-m raid6 -d raid6" + # Default configurations to test. + local configs=( + "single:single" + "dup:single" + "raid0:raid0" + "raid1:raid0" + "raid1:raid1" + "raid10:raid10" + "raid5:raid5" + "raid6:raid6" ) + else + # User-provided configurations. + local configs=(${BTRFS_PROFILE_CONFIGS[@]}) + fi - # remove dup/raid5/raid6 profiles if we're doing device replace - # dup profile indicates only one device being used (SCRATCH_DEV), - # but we don't want to replace SCRATCH_DEV, which will be used in - # _scratch_mount/_check_scratch_fs etc. - # and raid5/raid6 doesn't support replace yet + _btrfs_profile_configs=() + for cfg in "${configs[@]}"; do + local supported=true + local profiles=(${cfg/:/ }) if [ "$1" == "replace" ]; then - _btrfs_profile_configs=( - "-m single -d single" - "-m raid0 -d raid0" - "-m raid1 -d raid0" - "-m raid1 -d raid1" - "-m raid10 -d raid10" - # add these back when raid5/6 is working with replace - #"-m raid5 -d raid5" - #"-m raid6 -d raid6" + # We can't do replace with these profiles because they + # imply only one device ($SCRATCH_DEV), and we need to + # keep $SCRATCH_DEV around for _scratch_mount + # and _check_scratch_fs. + local unsupported=( + "dup" ) + elif [ "$1" == "replace-missing" ]; then + # We can't replace missing devices with these profiles + # because there isn't enough redundancy. + local unsupported=( + "single" + "dup" + "raid0" + ) + else + local unsupported=() fi - export _btrfs_profile_configs - return - fi - - # parse user specified btrfs profile configs - local i=0 - local cfg="" - for cfg in $BTRFS_PROFILE_CONFIGS; do - # turn "metadata:data" format to "-m metadata -d data" - # and assign it to _btrfs_profile_configs array - cfg=`echo "$cfg" | sed -e 's/^/-m /' -e 's/:/ -d /'` - _btrfs_profile_configs[$i]="$cfg" - let i=i+1 - done - - if [ "$1" == "replace" ]; then - if echo ${_btrfs_profile_configs[*]} | grep -q raid[56]; then - _notrun "RAID5/6 doesn't support btrfs device replace yet" - fi - if echo ${_btrfs_profile_configs[*]} | grep -q dup; then - _notrun "Do not set dup profile in btrfs device replace test" + for unsupp in "${unsupported[@]}"; do + if [ "${profiles[0]}" == "$unsupp" -o "${profiles[1]}" == "$unsupp" ]; then + if [ -z "$BTRFS_PROFILE_CONFIGS" ]; then + # For the default config, just omit it. + supported=false + else + # For user-provided config, don't run the test. + _notrun "Profile $unsupp not supported for $1" + fi + fi + done + if "$supported"; then + _btrfs_profile_configs+=("-m ${profiles[0]} -d ${profiles[1]}") fi - fi + done export _btrfs_profile_configs }