From patchwork Tue Feb 27 12:25:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13573748 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44A7013A871; Tue, 27 Feb 2024 12:25:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709036735; cv=none; b=LKReg1w6busV9dJdXUh8ArDj6jqV9f062GFCaPCDXNYzVNjrXDa2gdB4/UYwTGujFIUD3h5KK22s4063vWr0OWgFn0wlFU77k2/9bgq3+fY9+3P0NpyUtT/nEdZlvgsoFrf/2kZ3iDa/rYNbgj7/K2mMBojTZvlVGEMBAaEXAlQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709036735; c=relaxed/simple; bh=s6VCn/z0+jYYf8daVbNG+1VTEge0AwHJNJCWm1QMJ7Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tEsmZAlRe/rL0+qBez35eKUq40NvIA6bHyaHx41LDU2zNW0ImCyKEhPKOXAth0gC6cgUJR3A9/5mToiPDPFTzrQuXtjeN8DZhM3CcZXj4cyq7/po+jAkGvRZlPjbMyGE2KnDmv4b5dtxJidCiid9AZGun8m7eDw4Qe5hUdp061M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a3f1bf03722so451018866b.1; Tue, 27 Feb 2024 04:25:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709036732; x=1709641532; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hk160t0hpNdsuUo4r/gUPx/Lha/H4yfcNdpgjzciUTU=; b=AWYNxgDg1L1ewNlq6eGdoCcTjLYQkDU6Zx+0/6aeOJzLas78ybyOGZZSLSuJl4F422 9mlXrb2pmWoAxSNF9iixG2BcldIGEyJ1vnWHIBjbGrDCQ4o73SFZ6a4NowGdtdzexPQX jjFjgB4zS/oZhump/Af6vgje+cYTWtmBjfz47iy3ehZ+u4RProza8h81XNPOeMozt6bn 2M85WHQG0LF5GMS+qDVAFgVabN0M72Q2huvG2MEgrrUKglFJJ93TtGU1lYtDCv6pUTrm 1QhuJ832P4xHUmZcwDnOiPpCDUFWJ5xkwHsSkJmdqow7BWSAuUiri2PHiQyCZ7hx4E8a /p7g== X-Forwarded-Encrypted: i=1; AJvYcCUQLJYVwItrmDkOetZVxK/W2D4u8/UoC5N1NVQGCamjX9POw+0Wy2gsX5o/JowNweo4az3TafKplIlatTZqTqIfSnDtlFCXZWdFWz4tWt8hpnR19ZUHnVgPO54mZRHicvN7DMNQ X-Gm-Message-State: AOJu0YyurWT2Rqg4nQu1cspbFVlhvB6ENJxExPHIIQbngQf3p6nPE6fJ VfX7I3JKF8UUrexCrI7hOexwQbYv4cLPZt5iHjHfvdLQ5HVFiG+qrHCe+zTG+kE= X-Google-Smtp-Source: AGHT+IFYt4RBTkaFHyPvbfc6qf4Hwprd9wZlb3If88VgqaixF5r6f8OwR0mfRr6OpANL1zJ7Vdk8XQ== X-Received: by 2002:a17:906:4f91:b0:a3e:b869:11b3 with SMTP id o17-20020a1709064f9100b00a3eb86911b3mr5952118eju.55.1709036732544; Tue, 27 Feb 2024 04:25:32 -0800 (PST) Received: from nuc.fritz.box (p200300f6f7068b00fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f706:8b00:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id vo14-20020a170907a80e00b00a4136d18988sm721938ejc.36.2024.02.27.04.25.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 04:25:32 -0800 (PST) From: Johannes Thumshirn Date: Tue, 27 Feb 2024 13:25:29 +0100 Subject: [PATCH v4 1/3] filter.brtfs: add filter for conversion Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240227-balance-fix-v4-1-d22d63972d93@kernel.org> References: <20240227-balance-fix-v4-0-d22d63972d93@kernel.org> In-Reply-To: <20240227-balance-fix-v4-0-d22d63972d93@kernel.org> To: Anand Jain Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, fstests@vger.kernel.org, Zorro Lang , Johannes Thumshirn X-Mailer: b4 0.12.4 From: Johannes Thumshirn Add a filter for the output of btrfs-balance with a convert argument. Signed-off-by: Johannes Thumshirn --- common/filter.btrfs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/filter.btrfs b/common/filter.btrfs index 8ab76fcb..ea76e729 100644 --- a/common/filter.btrfs +++ b/common/filter.btrfs @@ -141,5 +141,11 @@ _filter_stripe_tree() -e "s/bytes used [0-9]+/bytes used XXXXXX/" } +# filter output of "btrfs balance start -[smd] convert +_filter_balance_convert() +{ + _filter_scratch | \ + sed -e "s/relocate [0-9]\+ out of [0-9]\+ chunks/relocate X out of X chunks/g" +} # make sure this script returns success /bin/true From patchwork Tue Feb 27 12:25:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13573749 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11E8813AA47; Tue, 27 Feb 2024 12:25:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709036736; cv=none; b=JNj0N0EbzTlYxkIh+PyeNe7N9sHEpGu+mWFcZHwAIkEmEL0dSkyNQzbx/40HY274Xo7hlWWl09BPJNQR4T5v/LksCNA8PMKDhcn2yjA2bhb4U6xRuS32H6n+iI+dKvExVFqJANHj6Fpalk6W0ZVEOkvXThLrL4lioeNKUU84rio= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709036736; c=relaxed/simple; bh=cXyV73QRFV9H9hjPoogFsl56DiOTGl3fsrws0Rm3xaA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LG1Zv6cfDm70GyCTyHkVzDyT/G8SNOyhs93NUE0aHrMMDx5JQXmzsaOJPqRchPxWzUdmmWwoEIexkab2919pRWdRl5RRZeX2zu2Qq8F3OrGA3N9/BtmfyOfQzuanyfd2tqCJW/iaotUkNDnyuE08wymH+sti3rnlNUC/mwABVZo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a3ed9cae56fso690714666b.1; Tue, 27 Feb 2024 04:25:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709036733; x=1709641533; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VubS9gSyHqZkpFHj7uvWsTNv8yVN+0Og+LuVo7tWJCM=; b=we+R+kSDJSbgPTjwkMt+kn6q+VWqnPB0MlmjdMu6YtjrupW3VRb+vr8n/FvUw0wha0 mfby3EbgwE5z9S+9JBdSg/o+MfXei1NroE21azNr9Z5LI+4ro0DlIIC6q5CWZyIKi4Mk c2Jh0gJ0E4uxamSGWsOMT7f9JguwUOR4wbkHExUINfuiVXWqbyw/30nX3XxbzTs0USRk 3t65FmnbXo6E6xp+50AllKefg0YoEPiFMHd9HqNj7FaBcmmPK45wGXYp4Ktk9ZYF1ZRK Ykq4IDw7HlzU87Z7Hl2ZDAV/tMjXTUEZ6dEBM6HM1cXFVt0STImvtwUCSxrA428EsOjJ HZ6g== X-Forwarded-Encrypted: i=1; AJvYcCVf9TPQdW+SLO5ISnklSJVlVl4wG+5By3Aro0H4KxYlbXR9/nRHyFzUvZ2FY/XsFnvO9QzqvCv/fzhLYyEFlZaFTWuKUJuFpXsvRZ3xe62fjy4+mlQTybEOAN6oNA4NCcSAABta X-Gm-Message-State: AOJu0YyDGP3TyPoFT+ybFY63j5xPAE/wHnoXojCEOmzNY/1I9mjHYXf+ 4bK22EY2QVhdM6hbFCX2/nM+p/JELEvrZqlj1Eag9GCaXfqt38ElrWaoxmXESqU= X-Google-Smtp-Source: AGHT+IEA/0Abcxs8b9gB8E4WsB0tOvnErTLbn2K/QIWYx6WdOzoryky4vdl/pQr0O+DjUubL620Dlw== X-Received: by 2002:a17:906:579a:b0:a43:2827:9c73 with SMTP id k26-20020a170906579a00b00a4328279c73mr4989652ejq.36.1709036733468; Tue, 27 Feb 2024 04:25:33 -0800 (PST) Received: from nuc.fritz.box (p200300f6f7068b00fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f706:8b00:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id vo14-20020a170907a80e00b00a4136d18988sm721938ejc.36.2024.02.27.04.25.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 04:25:33 -0800 (PST) From: Johannes Thumshirn Date: Tue, 27 Feb 2024 13:25:30 +0100 Subject: [PATCH v4 2/3] filter.btrfs: add filter for btrfs device add Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240227-balance-fix-v4-2-d22d63972d93@kernel.org> References: <20240227-balance-fix-v4-0-d22d63972d93@kernel.org> In-Reply-To: <20240227-balance-fix-v4-0-d22d63972d93@kernel.org> To: Anand Jain Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, fstests@vger.kernel.org, Zorro Lang , Johannes Thumshirn X-Mailer: b4 0.12.4 From: Johannes Thumshirn Add a filter for the output of btrfs device add. Signed-off-by: Johannes Thumshirn --- common/filter.btrfs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/filter.btrfs b/common/filter.btrfs index ea76e729..9ef96761 100644 --- a/common/filter.btrfs +++ b/common/filter.btrfs @@ -147,5 +147,14 @@ _filter_balance_convert() _filter_scratch | \ sed -e "s/relocate [0-9]\+ out of [0-9]\+ chunks/relocate X out of X chunks/g" } + +# filter output of "btrfs device add" +_filter_device_add() +{ + _filter_scratch | _filter_scratch_pool | \ + sed -e "/Resetting device zones SCRATCH_DEV ([0-9]\+/d" + +} + # make sure this script returns success /bin/true From patchwork Tue Feb 27 12:25:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13573750 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E51C813AA4C; Tue, 27 Feb 2024 12:25:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709036737; cv=none; b=TW3BnDAwkEe1xOWOss9EbbS0u55HgAPHRbObtTZQCPkXcM+8cbsztfgoFWyFqtyTvPxhuXOSoHaqiA4u8fJ6AWiQezsRN1J2HSFyOZUFisQhhO4LC9U2t/jQumrqY7bCmRaEdCeuSwhbSrw6grCklCeqpwCn32gpy/zt69JZ+oo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709036737; c=relaxed/simple; bh=s/ocJovMVVz66LH8YmsguObW/ovi0MzCtC0l/SvpLzo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AkhrEGWg0Kty/9/es28Aju6Ri8TkMRRRFZ/dMiLN+KvYiNz+IaKglFStOhJEOq+RO77roKqNKOhSJox4IYTiA9XNavMnBzPY5x+UfaC6kkHz+eb/B6318RkpvdeKiFvCLLNRM6uVtzXnLVllyic4IoiNtINxS6bippKvpMAB8A0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a3f5808b0dfso574726066b.1; Tue, 27 Feb 2024 04:25:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709036734; x=1709641534; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qpzVidqk0eRWGSDOtuDFjtvaTVT5ktnhlxcnQjxF1yo=; b=ON7FHIjGQ7Zha90KSorPB7L+As+BzqaqPfIqeAivTNvqNAWwXy6WXdBeT5/UlCS6wf zdVICxBFZJrv8nbqoHqVnZiBITtWjrJFFE/BRHoX8ETQK5G3tVkOFJh6e9WFiWKYkMDY pAYKCmTONEzX83zyPDSPxud98nKMTdSQTOLTrDEMWOhbArsP2opZ3/xZy0BNsysVyy4+ /kwab+LeAJKcxJfWV2i7Hh3pDVw8J1hVw+MGlJj8WiIXl/E7KqqeOFC37otCHbelZyZm LjBVG50gWljFlwn6i/4AAEAYtpiv9a/J7ma6uVr2vsdWR3ZLZJ5KSFVFNRpcWLuNZh7B 5DGA== X-Forwarded-Encrypted: i=1; AJvYcCXmZgPN5E2w8vpfT2dZBnL9CvczXJu9W72KTIu5KGIIFKqqsoUS4/CFjAdsXvujRxZ5/Us357uxRlv/iyx9TwLD3f8Y2IOs15ighiC6OlOIk2QUbZ+bvCDDTBJrorcEblvZwDms X-Gm-Message-State: AOJu0YwprCayTzVsSO1ygvYECfQcdY+itxNfviSqlsWZ+Sc3YcFj4eIk WgKgjtrVKYaLQesLEmDzFWT3Y5ku+8S7RERjlRSF/HDZObbvKRcSUZxnSIdZA2w= X-Google-Smtp-Source: AGHT+IHYWrYYerbBpePBbqHqVFRigzPZHBQ/9s78w2bn27T5NlfUFZ2AyFFWaD1Wx68/OJ2cI6JnqQ== X-Received: by 2002:a17:906:4748:b0:a3f:357b:d995 with SMTP id j8-20020a170906474800b00a3f357bd995mr6483184ejs.1.1709036734308; Tue, 27 Feb 2024 04:25:34 -0800 (PST) Received: from nuc.fritz.box (p200300f6f7068b00fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f706:8b00:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id vo14-20020a170907a80e00b00a4136d18988sm721938ejc.36.2024.02.27.04.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 04:25:33 -0800 (PST) From: Johannes Thumshirn Date: Tue, 27 Feb 2024 13:25:31 +0100 Subject: [PATCH v4 3/3] fstests: btrfs: check conversion of zoned fileystems Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240227-balance-fix-v4-3-d22d63972d93@kernel.org> References: <20240227-balance-fix-v4-0-d22d63972d93@kernel.org> In-Reply-To: <20240227-balance-fix-v4-0-d22d63972d93@kernel.org> To: Anand Jain Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, fstests@vger.kernel.org, Zorro Lang , Johannes Thumshirn , Filipe Manana X-Mailer: b4 0.12.4 From: Johannes Thumshirn Recently we had a bug where a zoned filesystem could be converted to a higher data redundancy profile than supported. Add a test-case to check the conversion on zoned filesystems. Reviewed-by: Filipe Manana Signed-off-by: Johannes Thumshirn --- tests/btrfs/310 | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/310.out | 9 +++++++ 2 files changed, 76 insertions(+) diff --git a/tests/btrfs/310 b/tests/btrfs/310 new file mode 100755 index 00000000..c39f6016 --- /dev/null +++ b/tests/btrfs/310 @@ -0,0 +1,67 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Western Digital Corporation. All Rights Reserved. +# +# FS QA Test 310 +# +# Test that btrfs convert can ony be run to convert to supported profiles on a +# zoned filesystem +# +. ./common/preamble +_begin_fstest volume raid convert + +_fixed_by_kernel_commit XXXXXXXXXX \ + "btrfs: zoned: don't skip block group profile checks on conv zones" + +. common/filter.btrfs + +_supported_fs btrfs +_require_scratch_dev_pool 4 +_require_zoned_device "$SCRATCH_DEV" + +devs=( $SCRATCH_DEV_POOL ) + +# Create and mount single device FS +_scratch_mkfs -msingle -dsingle 2>&1 > /dev/null +_scratch_mount + +# Convert FS to metadata/system DUP +_run_btrfs_balance_start -f -mconvert=dup -sconvert=dup $SCRATCH_MNT 2>&1 |\ + _filter_balance_convert + +# Convert FS to data DUP, must fail +_run_btrfs_balance_start -dconvert=dup $SCRATCH_MNT 2>&1 |\ + _filter_balance_convert + +# Add device +$BTRFS_UTIL_PROG device add ${devs[1]} $SCRATCH_MNT | _filter_device_add + +# Convert FS to data RAID1, must fail +_run_btrfs_balance_start -dconvert=raid1 $SCRATCH_MNT 2>&1 |\ + _filter_balance_convert | head -1 + +# Convert FS to data RAID0, must fail +_run_btrfs_balance_start -dconvert=raid0 $SCRATCH_MNT 2>&1 |\ + _filter_balance_convert | head -1 + +# Add device +$BTRFS_UTIL_PROG device add ${devs[2]} $SCRATCH_MNT | _filter_device_add + +# Convert FS to data RAID5, must fail +_run_btrfs_balance_start -f -dconvert=raid5 $SCRATCH_MNT 2>&1 |\ + _filter_balance_convert | head -1 + +# Add device +$BTRFS_UTIL_PROG device add ${devs[3]} $SCRATCH_MNT | _filter_device_add + +# Convert FS to data RAID10, must fail +_run_btrfs_balance_start -dconvert=raid10 $SCRATCH_MNT 2>&1 |\ + _filter_balance_convert | head -1 + +# Convert FS to data RAID6, must fail +_run_btrfs_balance_start -f -dconvert=raid6 $SCRATCH_MNT 2>&1 |\ + _filter_balance_convert | head -1 + +# success, all done +status=0 +exit diff --git a/tests/btrfs/310.out b/tests/btrfs/310.out new file mode 100644 index 00000000..cef2e5ab --- /dev/null +++ b/tests/btrfs/310.out @@ -0,0 +1,9 @@ +QA output created by 310 +Done, had to relocate X out of X chunks +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument +There may be more info in syslog - try dmesg | tail +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument