From patchwork Thu Sep 28 23:16:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Burkov X-Patchwork-Id: 13403565 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45E55E743CE for ; Thu, 28 Sep 2023 23:16:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229794AbjI1XQF (ORCPT ); Thu, 28 Sep 2023 19:16:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbjI1XQE (ORCPT ); Thu, 28 Sep 2023 19:16:04 -0400 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6AB319F; Thu, 28 Sep 2023 16:15:58 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 30CF05C0130; Thu, 28 Sep 2023 19:15:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 28 Sep 2023 19:15:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bur.io; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1695942958; x= 1696029358; bh=j+KD/sriX+e/wWHTpgo0NBnggBDG5I8dvFVim9K0Vrc=; b=C CwtEzJBU0ClN02vR025tZLjVxXMkSFvztoIMIUttAicixX8vbX66NA+RjNJEynbL /iRs7zpI2brcDZdm9A5GCNsIhRIw8okh/i7DWItw3jmRc0NlwQyHBuujIRpZIgth Je9qZ1qeY1MdLx92eXBnYGa3xkPZsuXJQyDpU17jJQdXVWUKNB6TBruBVqr0XcTb nUT5pGtLBpV3lDpSrn6Spn6oYpmAJL6J1VQyB7/DeA+noyh38WE0UDJjno4KGT5p 6UvMyQZ8TiRnFlSDEZgkSP/hFI/10AkEZiYOh5Uf5V0nQ9QrypGj2pMGoNW8T6eC EkP03qbwft2xeICjiVsaw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1695942958; x=1696029358; bh=j +KD/sriX+e/wWHTpgo0NBnggBDG5I8dvFVim9K0Vrc=; b=OSOKL0UUCx2EIE+tT 07ai3oeD9sFpwd+rz5Jurv2w1oiIVZ7itO7zAwOQrln0H06pgGrj0YXcvD8ClyYd +XcVx1KJ58/N/Ijx8inzg/vdWUwkS1oTQhFKZbewoDiI/0eyLYG2uviFbFySyb2b dI07dEvtR0KEYCA+5GCpz6KLbEFQi2yIGTebXEGrM3aOW0L+W6eLPZHJ46GNU1Y3 +qIJLVIN2f/acb+GNHHaLLo3z2Q04v3hmg9LkgA/WRh3JVrOJniTWy0kwsKjcDCo iMsDTBEGYbMiAuwWF7H4Dx9xnLf8Po4bDkY9rlW2pjLiUtbnHeAAIaIEORSP6SFo jMDxQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrtddugddvudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeeuohhrihhsuceuuhhrkhhovhcuoegsohhrihhssegsuhhrrdhi oheqnecuggftrfgrthhtvghrnhepieeuffeuvdeiueejhfehiefgkeevudejjeejffevvd ehtddufeeihfekgeeuheelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomhepsghorhhishessghurhdrihho X-ME-Proxy: Feedback-ID: i083147f8:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 28 Sep 2023 19:15:57 -0400 (EDT) From: Boris Burkov To: linux-btrfs@vger.kernel.org, kernel-team@fb.com, fstests@vger.kernel.org Subject: [PATCH v4 1/6] common: refactor sysfs_attr functions Date: Thu, 28 Sep 2023 16:16:43 -0700 Message-ID: <0714f6b21000181ab43d3085903859b8ae1e1a32.1695942727.git.boris@bur.io> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org Expand the has/get/require functions to allow passing a dev by parameter, and implement the test_dev specific one in terms of the new generic one. Signed-off-by: Boris Burkov Reviewed-by: Anand Jain --- common/rc | 127 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 82 insertions(+), 45 deletions(-) diff --git a/common/rc b/common/rc index 1618ded54..c3cd53546 100644 --- a/common/rc +++ b/common/rc @@ -4689,47 +4689,33 @@ run_fsx() rm -f $tmp.fsx } -# Test for the existence of a sysfs entry at /sys/fs/$FSTYP/DEV/$ATTR +_require_statx() +{ + $here/src/stat_test --check-statx || + _notrun "This test requires the statx system call" +} + +# Get the path to the sysfs directory for the fs on a device # # Only one argument is needed: -# - attr: path name under /sys/fs/$FSTYP/DEV +# - dev: mounted block device for the fs # # Usage example: -# _require_fs_sysfs error/fail_at_unmount -_has_fs_sysfs() +# _fs_sysfs_dname /dev/mapper/scratch-dev +_fs_sysfs_dname() { - local attr=$1 - local dname + local dev=$1 + + if [ ! -b "$dev" ]; then + _fail "Usage: _fs_sysfs_dname " + fi case "$FSTYP" in btrfs) - dname=$(findmnt -n -o UUID $TEST_DEV) ;; + findmnt -n -o UUID ${dev} ;; *) - dname=$(_short_dev $TEST_DEV) ;; + _short_dev $dev ;; esac - - if [ -z "$attr" -o -z "$dname" ];then - _fail "Usage: _require_fs_sysfs " - fi - - test -e /sys/fs/${FSTYP}/${dname}/${attr} -} - -# Require the existence of a sysfs entry at /sys/fs/$FSTYP/DEV/$ATTR -_require_fs_sysfs() -{ - _has_fs_sysfs "$@" && return - - local attr=$1 - local dname=$(_short_dev $TEST_DEV) - - _notrun "This test requires /sys/fs/${FSTYP}/${dname}/${attr}" -} - -_require_statx() -{ - $here/src/stat_test --check-statx || - _notrun "This test requires the statx system call" } # Write "content" into /sys/fs/$FSTYP/$DEV/$ATTR @@ -4753,13 +4739,7 @@ _set_fs_sysfs_attr() _fail "Usage: _set_fs_sysfs_attr " fi - local dname - case "$FSTYP" in - btrfs) - dname=$(findmnt -n -o UUID ${dev}) ;; - *) - dname=$(_short_dev $dev) ;; - esac + local dname=$(_fs_sysfs_dname $dev) echo "$content" > /sys/fs/${FSTYP}/${dname}/${attr} } @@ -4781,17 +4761,74 @@ _get_fs_sysfs_attr() _fail "Usage: _get_fs_sysfs_attr " fi - local dname - case "$FSTYP" in - btrfs) - dname=$(findmnt -n -o UUID ${dev}) ;; - *) - dname=$(_short_dev $dev) ;; - esac + local dname=$(_fs_sysfs_dname $dev) cat /sys/fs/${FSTYP}/${dname}/${attr} } +# Test for the existence of a sysfs entry at /sys/fs/$FSTYP/$DEV/$ATTR +# +# All arguments are necessary, and in this order: +# - dev: device name, e.g. $SCRATCH_DEV +# - attr: path name under /sys/fs/$FSTYP/$dev +# +# Usage example: +# _has_fs_sysfs_attr /dev/mapper/scratch-dev error/fail_at_unmount +_has_fs_sysfs_attr() +{ + local dev=$1 + local attr=$2 + + if [ ! -b "$dev" -o -z "$attr" ];then + _fail "Usage: _get_fs_sysfs_attr " + fi + + local dname=$(_fs_sysfs_dname $dev) + + test -e /sys/fs/${FSTYP}/${dname}/${attr} +} + +# Require the existence of a sysfs entry at /sys/fs/$FSTYP/$DEV/$ATTR +# All arguments are necessary, and in this order: +# - dev: device name, e.g. $SCRATCH_DEV +# - attr: path name under /sys/fs/$FSTYP/$dev +# +# Usage example: +# _require_fs_sysfs_attr /dev/mapper/scratch-dev error/fail_at_unmount +_require_fs_sysfs_attr() +{ + _has_fs_sysfs_attr "$@" && return + + local dev=$1 + local attr=$2 + local dname=$(_fs_sysfs_dname $dev) + + _notrun "This test requires /sys/fs/${FSTYP}/${dname}/${attr}" +} + +# Test for the existence of a sysfs entry at /sys/fs/$FSTYP/DEV/$ATTR +# +# Only one argument is needed: +# - attr: path name under /sys/fs/$FSTYP/DEV +# +# Usage example: +# _has_fs_sysfs error/fail_at_unmount +_has_fs_sysfs() +{ + _has_fs_sysfs_attr $TEST_DEV "$@" +} + +# Require the existence of a sysfs entry at /sys/fs/$FSTYP/DEV/$ATTR +_require_fs_sysfs() +{ + _has_fs_sysfs "$@" && return + + local attr=$1 + local dname=$(_short_dev $TEST_DEV) + + _notrun "This test requires /sys/fs/${FSTYP}/${dname}/${attr}" +} + # Generic test for specific filesystem feature. # Currently only implemented to test overlayfs features. _require_scratch_feature() From patchwork Thu Sep 28 23:16:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Burkov X-Patchwork-Id: 13403568 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E229FE743D0 for ; Thu, 28 Sep 2023 23:16:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230325AbjI1XQF (ORCPT ); Thu, 28 Sep 2023 19:16:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229654AbjI1XQE (ORCPT ); Thu, 28 Sep 2023 19:16:04 -0400 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B1E31A3; Thu, 28 Sep 2023 16:16:00 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id E7B485C00FD; Thu, 28 Sep 2023 19:15:59 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 28 Sep 2023 19:15:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bur.io; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1695942959; x= 1696029359; bh=l4ZHhDlqoTZg/LmFnodXCFvG0S8zJyyVhIsZF/Z9sbM=; b=s ockXJQFlkYxVGwE1Blqy/lRP9JYRw49NyL0+UW1EX3Mym+9BLSVBy2ol9MPLkU9K AC1r1ufbTzFaT2x1cgPPVVF05pLfH3q7WCuJDUZfAVno5yl/vz4aOLNvlxQp2fxV ZihmIu5QLRKdkMZ+neRcBeaiD+r24++NYMH1QKsWkiMMDAkrjgMucmrz3BhdCA3K OlO5xQbAvUPHzGixXO+dXkFIrnNNn0WjON+nLj1SqucWTios2S8ERvef2Pw2pUZ4 cLKeg4E4zMQXqbdlytK2oTs5xddmiYnr6tZYo8FYyskA4fuaDXOYIxcb1JinaqT5 Idx18t8mJAPfCjfA4E0cg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1695942959; x=1696029359; bh=l 4ZHhDlqoTZg/LmFnodXCFvG0S8zJyyVhIsZF/Z9sbM=; b=QsKXBuursVlY9h8B4 urAK3GktizBVXAxFPVysDgocC23WsdHsDzANWc6IcrDllBnUuyFHClInSUTYRvac nRRz6gjxawIttMFmiV9UULXcsN3ScnrbIHHU1FsGc7I/o2rZ3Wi3CNdVLAA0TsF1 FDJHd18sSxPNs9x3NLbCnhJag2n/FamyluN5OC1yHvA+evpv8m7mxc/4gJObJM/K HlpU291w6aTkJuceSDl2a4g0LR6alNC0+4j2luvlUzsqRKN2HGfhwpETJwa2gUqw lHsBEuYmj+R2R1N5jcvMDT33itdggmeTj56SjeSZ12r9+MzHmnxebQwdQmcrq/U9 BIelg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrtddugddvtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeeuohhrihhsuceuuhhrkhhovhcuoegsohhrihhssegsuhhrrdhi oheqnecuggftrfgrthhtvghrnhepieeuffeuvdeiueejhfehiefgkeevudejjeejffevvd ehtddufeeihfekgeeuheelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomhepsghorhhishessghurhdrihho X-ME-Proxy: Feedback-ID: i083147f8:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 28 Sep 2023 19:15:59 -0400 (EDT) From: Boris Burkov To: linux-btrfs@vger.kernel.org, kernel-team@fb.com, fstests@vger.kernel.org Subject: [PATCH v4 2/6] btrfs: quota mode helpers Date: Thu, 28 Sep 2023 16:16:44 -0700 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org To facilitate skipping tests depending on the qgroup mode after mkfs, add support for figuring out the mode. This cannot just rely on the new sysfs file, since it might not be present on older kernels. Signed-off-by: Boris Burkov Reviewed-by: Anand Jain --- common/btrfs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/common/btrfs b/common/btrfs index c9903a413..8d51bd522 100644 --- a/common/btrfs +++ b/common/btrfs @@ -689,3 +689,41 @@ _require_btrfs_scratch_logical_resolve_v2() fi _scratch_unmount } + +_qgroup_mode() +{ + local dev=$1 + + if [ ! -b "$dev" ]; then + _fail "Usage: _qgroup_mode " + fi + + if _has_fs_sysfs_attr $dev /qgroups/mode; then + _get_fs_sysfs_attr $dev qgroups/mode + else + echo "disabled" + fi +} + +_check_regular_qgroup() +{ + _qgroup_mode "$@" | grep -q 'qgroup' +} + +_require_scratch_qgroup() +{ + _scratch_mkfs >>$seqres.full 2>&1 + _scratch_mount + _run_btrfs_util_prog quota enable $SCRATCH_MNT + _check_regular_qgroup $SCRATCH_DEV || _notrun "not running normal qgroups" + _scratch_unmount +} + +_require_scratch_enable_simple_quota() +{ + _scratch_mkfs >>$seqres.full 2>&1 + _scratch_mount + _qgroup_mode $SCRATCH_DEV | grep 'squota' && _notrun "cannot enable simple quota; on by default" + $BTRFS_UTIL_PROG quota enable --simple $SCRATCH_MNT || _notrun "simple quotas not available" + _scratch_unmount +} From patchwork Thu Sep 28 23:16:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Burkov X-Patchwork-Id: 13403569 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C80AE743D4 for ; Thu, 28 Sep 2023 23:16:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229653AbjI1XQH (ORCPT ); Thu, 28 Sep 2023 19:16:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230246AbjI1XQF (ORCPT ); Thu, 28 Sep 2023 19:16:05 -0400 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AD1AAC; Thu, 28 Sep 2023 16:16:02 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id A71D45C0D7F; Thu, 28 Sep 2023 19:16:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 28 Sep 2023 19:16:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bur.io; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1695942961; x= 1696029361; bh=x2QHxuH8lObiGj2LOCOlk8XB1T+HkuJFk5TsMTDz7T0=; b=P dsJ1YsNkdEcorYqyT8qd17n/4zqSM1d6QH3RhHwbMQ8M3B3hrQqPqkwm2lYaI2sF 7YMCv8aur/DmkYn6jb7HAiZo7iVKubKBf4P+4gzjmQTgP2bgWRBzEpcYJULVZHHT zsjGTNeMG9bVdCZ6LXTZ9icf67/iKHWJAZhEpu7nKAwU+zMjtVzQo5ArLu9esLAC q+SN7xuSFnGtrG3y2ghEDG8cvgIT4MflPYrUIwlxHiyvlgVqPPn4q5f4iPwrNOyO YjHDeIqGXH3sbvZK+Qm7MYOdCGfZszpB/5aXvTTX4gKEMLd7+ELz4zIRL7q3HWT/ mHgieDRpeNj0BMYhJd64A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1695942961; x=1696029361; bh=x 2QHxuH8lObiGj2LOCOlk8XB1T+HkuJFk5TsMTDz7T0=; b=NFteT+sSN05eM+1DM u8Wbcxh4FF66oLPXPVEbdE4ZxTOxA2lzVD4L/P+8HQw/BPNAnuHc6xXCEwylJW9X VNYDqTq3pkz2f7GV4RLd0pPvU9amdRN6PT3VC3VkDxXWU9miN7G95iFhd4oilice /wM64/2VNqhwc38m7eWJ2bOFXnKOcOV9P46lEenDtIKtwO8/lAW5C+xVhJ74QYdM tNgoA4vJLhs52kC1Od+kc4mhE/G8BDdoTz7rSCPfiDDm17SlS//EOhJJWjmj54fR CRSAFeilKbZpWCruJMW6qQJGLKYgKFK4tk58dDXnawKgn05aJCNh7GmTGhhsxG+Q b4OsQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrtddugddvudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeeuohhrihhsuceuuhhrkhhovhcuoegsohhrihhssegsuhhrrdhi oheqnecuggftrfgrthhtvghrnhepieeuffeuvdeiueejhfehiefgkeevudejjeejffevvd ehtddufeeihfekgeeuheelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomhepsghorhhishessghurhdrihho X-ME-Proxy: Feedback-ID: i083147f8:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 28 Sep 2023 19:16:01 -0400 (EDT) From: Boris Burkov To: linux-btrfs@vger.kernel.org, kernel-team@fb.com, fstests@vger.kernel.org Subject: [PATCH v4 3/6] btrfs/301: new test for simple quotas Date: Thu, 28 Sep 2023 16:16:45 -0700 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org Test some interesting basic and edge cases of simple quotas. To some extent, this is redundant with the alternate testing strategy of using MKFS_OPTIONS to enable simple quotas, running the full suite and relying on kernel warnings and fsck to surface issues. Signed-off-by: Boris Burkov --- tests/btrfs/301 | 435 ++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/301.out | 18 ++ 2 files changed, 453 insertions(+) create mode 100755 tests/btrfs/301 create mode 100644 tests/btrfs/301.out diff --git a/tests/btrfs/301 b/tests/btrfs/301 new file mode 100755 index 000000000..227ce9fc5 --- /dev/null +++ b/tests/btrfs/301 @@ -0,0 +1,435 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2023 Meta Platforms, Inc. All Rights Reserved. +# +# FS QA Test 301 +# +# Test common btrfs simple quotas scenarios involving sharing extents and +# removing them in various orders. +# +. ./common/preamble +_begin_fstest auto quick qgroup clone subvol prealloc snapshot + +# Import common functions. +. ./common/reflink + +# Real QA test starts here. + +# Modify as appropriate. +_supported_fs btrfs +_require_scratch_reflink +_require_cp_reflink +_require_btrfs_command inspect-internal dump-tree +_require_xfs_io_command "falloc" +_require_scratch_enable_simple_quota + +subv=$SCRATCH_MNT/subv +nested=$SCRATCH_MNT/subv/nested +snap=$SCRATCH_MNT/snap +nr_fill=512 +fill_sz=$((8 * 1024)) +total_fill=$(($nr_fill * $fill_sz)) +nodesize=$($BTRFS_UTIL_PROG inspect-internal dump-super $SCRATCH_DEV | grep nodesize | $AWK_PROG '{print $2}') +ext_sz=$((128 * 1024 * 1024)) +limit_nr=8 +limit=$(($ext_sz * $limit_nr)) + +prep_fio_config=$tmp.fio +fio_out=$tmp.fio.out +cat >$prep_fio_config <> $seqres.full + _scratch_mount + enable_quota "s" + $BTRFS_UTIL_PROG subvolume create $subv >> $seqres.full + set_subvol_limit 256 $limit + check_subvol_usage 256 0 + + # Create a bunch of little filler files to generate several levels in + # the btree, to make snapshotting sharing scenarios complex enough. + $FIO_PROG $prep_fio_config --output=$fio_out + check_subvol_usage 256 $total_fill + + # Create a single file whose extents we will explicitly share/unshare. + do_write $subv/f $ext_sz + check_subvol_usage 256 $(($total_fill + $ext_sz)) +} + +prepare_snapshotted() +{ + prepare + $BTRFS_UTIL_PROG subvolume snapshot $subv $snap >> $seqres.full + check_subvol_usage 256 $(($total_fill + $ext_sz)) + check_subvol_usage 257 0 +} + +prepare_nested() +{ + prepare + $BTRFS_UTIL_PROG qgroup create 1/100 $SCRATCH_MNT + $BTRFS_UTIL_PROG qgroup limit $limit 1/100 $SCRATCH_MNT + $BTRFS_UTIL_PROG qgroup assign 0/256 1/100 $SCRATCH_MNT >> $seqres.full + $BTRFS_UTIL_PROG subvolume create $nested >> $seqres.full + do_write $nested/f $ext_sz + check_subvol_usage 257 $ext_sz + check_subvol_usage 256 $(($total_fill + $ext_sz)) + local subv_usage=$(get_subvol_usage 256) + local nested_usage=$(get_subvol_usage 257) + check_qgroup_usage 1/100 $(($subv_usage + $nested_usage)) +} + +# Write in a single subvolume, including going over the limit. +basic_accounting() +{ + echo "basic accounting" + prepare + rm $subv/f + check_subvol_usage 256 $total_fill + cycle_mount_check_subvol_usage 256 $total_fill + do_write $subv/tmp 512M + rm $subv/tmp + do_write $subv/tmp 512M + rm $subv/tmp + do_enospc_falloc $subv/large_falloc 2G + do_enospc_write $subv/large 2G + _scratch_unmount +} + +# Write to the same range of a file a bunch of times in a row +# to test extent aware reservations. +reservation_accounting() +{ + echo "reservation accounting" + prepare + for i in $(seq 10); do + do_write $subv/tmp 512M + rm $subv/tmp + done + do_enospc_write $subv/large 2G + _scratch_unmount +} + +# Write in a snapshot. +snapshot_accounting() +{ + echo "snapshot accounting" + prepare_snapshotted + touch $snap/f + check_subvol_usage 256 $(($total_fill + $ext_sz)) + check_subvol_usage 257 0 + do_write $snap/f $ext_sz + check_subvol_usage 256 $(($total_fill + $ext_sz)) + check_subvol_usage 257 $ext_sz + rm $snap/f + check_subvol_usage 256 $(($total_fill + $ext_sz)) + check_subvol_usage 257 0 + rm $subv/f + check_subvol_usage 256 $total_fill + check_subvol_usage 257 0 + cycle_mount_check_subvol_usage 256 $total_fill + check_subvol_usage 257 0 + _scratch_unmount +} + +# Delete the original ref first after a snapshot. +delete_snapshot_src_ref() +{ + echo "delete src ref first" + prepare_snapshotted + rm $subv/f + check_subvol_usage 256 $(($total_fill + $ext_sz)) + check_subvol_usage 257 0 + rm $snap/f + trigger_cleaner + check_subvol_usage 256 $total_fill + check_subvol_usage 257 0 + cycle_mount_check_subvol_usage 256 $total_fill + check_subvol_usage 257 0 + _scratch_unmount +} + +# Delete the snapshot ref first after a snapshot. +delete_snapshot_ref() +{ + echo "delete snapshot ref first" + prepare_snapshotted + rm $snap/f + check_subvol_usage 256 $(($total_fill + $ext_sz)) + check_subvol_usage 257 0 + rm $subv/f + check_subvol_usage 256 $total_fill + check_subvol_usage 257 0 + cycle_mount_check_subvol_usage 256 $total_fill + check_subvol_usage 257 0 + _scratch_unmount +} + +# Delete the snapshotted subvolume after a snapshot. +delete_snapshot_src() +{ + echo "delete snapshot src first" + prepare_snapshotted + $BTRFS_UTIL_PROG subvolume delete $subv >> $seqres.full + check_subvol_usage 256 $(($total_fill + $ext_sz)) + check_subvol_usage 257 0 + rm $snap/f + trigger_cleaner + check_subvol_usage 256 $total_fill + check_subvol_usage 257 0 + $BTRFS_UTIL_PROG subvolume delete $snap >> $seqres.full + trigger_cleaner + check_subvol_usage 256 0 + check_subvol_usage 257 0 + cycle_mount_check_subvol_usage 256 0 + check_subvol_usage 257 0 + _scratch_unmount +} + +# Delete the snapshot subvolume after a snapshot. +delete_snapshot() +{ + echo "delete snapshot first" + prepare_snapshotted + $BTRFS_UTIL_PROG subvolume delete $snap >> $seqres.full + check_subvol_usage 256 $(($total_fill + $ext_sz)) + check_subvol_usage 257 0 + $BTRFS_UTIL_PROG subvolume delete $subv >> $seqres.full + trigger_cleaner + check_subvol_usage 256 0 + check_subvol_usage 257 0 + _scratch_unmount +} + +# Write to a subvolume nested in another subvolume. +# Exercises the auto-inheritance feature of simple quotas. +nested_accounting() +{ + echo "nested accounting" + prepare_nested + rm $subv/f + check_subvol_usage 256 $total_fill + check_subvol_usage 257 $ext_sz + local subv_usage=$(get_subvol_usage 256) + local nested_usage=$(get_subvol_usage 257) + check_qgroup_usage 1/100 $(($subv_usage + $nested_usage)) + rm $nested/f + check_subvol_usage 256 $total_fill + check_subvol_usage 257 0 + subv_usage=$(get_subvol_usage 256) + nested_usage=$(get_subvol_usage 257) + check_qgroup_usage 1/100 $(($subv_usage + $nested_usage)) + do_enospc_falloc $nested/large_falloc 2G + do_enospc_write $nested/large 2G + _scratch_unmount +} + +# Enable simple quotas on a filesystem with existing extents. +enable_mature() +{ + echo "enable mature" + _scratch_mkfs >> $seqres.full + _scratch_mount + $BTRFS_UTIL_PROG subvolume create $subv >> $seqres.full + do_write $subv/f $ext_sz + # Sync before enabling squotas to reliably *not* count the writes + # we did before enabling. + sync + enable_quota "s" + set_subvol_limit 256 $limit + _scratch_cycle_mount + usage=$(get_subvol_usage 256) + [ $usage -lt $ext_sz ] || echo "captured usage from before enable $usage >= $ext_sz" + do_write $subv/g $ext_sz + usage=$(get_subvol_usage 256) + [ $usage -lt $ext_sz ] && echo "failed to capture usage after enable $usage < $ext_sz" + check_subvol_usage 256 $ext_sz + rm $subv/f + check_subvol_usage 256 $ext_sz + _scratch_cycle_mount + rm $subv/g + check_subvol_usage 256 0 + _scratch_unmount +} + +# Reflink a file within the subvolume. +reflink_accounting() +{ + echo "reflink" + prepare + # Do enough reflinks to prove that they're free. If they counted, then this wouldn't fit in the limit. + for i in $(seq $(($limit_nr * 2))); do + _cp_reflink $subv/f $subv/f.i + done + # Confirm that there is no additional data usage from the reflinks. + check_subvol_usage 256 $(($total_fill + $ext_sz)) + _scratch_unmount +} + +# Delete the src ref of a reflink first. +delete_reflink_src_ref() +{ + echo "delete reflink src ref" + prepare + _cp_reflink $subv/f $subv/f.link + check_subvol_usage 256 $(($total_fill + $ext_sz)) + rm $subv/f + check_subvol_usage 256 $(($total_fill + $ext_sz)) + rm $subv/f.link + check_subvol_usage 256 $(($total_fill)) + _scratch_unmount +} + +# Delete the link ref of a reflink first. +delete_reflink_ref() +{ + echo "delete reflink ref" + prepare + _cp_reflink $subv/f $subv/f.link + check_subvol_usage 256 $(($total_fill + $ext_sz)) + rm $subv/f.link + check_subvol_usage 256 $(($total_fill + $ext_sz)) + rm $subv/f + check_subvol_usage 256 $(($total_fill)) + _scratch_unmount +} + +basic_accounting +reservation_accounting +snapshot_accounting +delete_snapshot_src_ref +delete_snapshot_ref +delete_snapshot_src +delete_snapshot +nested_accounting +enable_mature +reflink_accounting +delete_reflink_src_ref +delete_reflink_ref + +# success, all done +status=0 +exit diff --git a/tests/btrfs/301.out b/tests/btrfs/301.out new file mode 100644 index 000000000..1c502689d --- /dev/null +++ b/tests/btrfs/301.out @@ -0,0 +1,18 @@ +QA output created by 301 +basic accounting +fallocate: Disk quota exceeded +pwrite: Disk quota exceeded +reservation accounting +pwrite: Disk quota exceeded +snapshot accounting +delete src ref first +delete snapshot ref first +delete snapshot src first +delete snapshot first +nested accounting +fallocate: Disk quota exceeded +pwrite: Disk quota exceeded +enable mature +reflink +delete reflink src ref +delete reflink ref From patchwork Thu Sep 28 23:16:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Burkov X-Patchwork-Id: 13403567 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0C80E743D3 for ; Thu, 28 Sep 2023 23:16:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231542AbjI1XQG (ORCPT ); Thu, 28 Sep 2023 19:16:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbjI1XQF (ORCPT ); Thu, 28 Sep 2023 19:16:05 -0400 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F7B219D; Thu, 28 Sep 2023 16:16:04 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 66F205C0DBB; Thu, 28 Sep 2023 19:16:03 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 28 Sep 2023 19:16:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bur.io; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1695942963; x= 1696029363; bh=VHL3K3RZ6/F72JVZUkxSZ3tzq++vFi+1nAyKppki0Dw=; b=J x0oBJlUNjK/350NJed494eMGRaPCFeHHUEWTOXBn9Btnc6+uZe57GHfAqp8A2a7g iHvGWnGm/jgCkJGAAppocR+EeSq/k3C5jVWkZXV4fDxboBnBqZij10iaSyrW69/H 73cqy7FP7RrRaaNd+YFq/aFy9DfumJ4h0eMyXH9poVTk9ePRTILWXBHRpx7C+Qtu hMPU0s+/qQEC2kkoJsoZAxaHFdSMhmBgwkC3HBBBHqh7JFtVkhRIsgicX0BSzxst JjRCLcrRCxilXoyuvRR7p17jfwY7vBohkN0CWwK0okb9pevnMIh1muMIvKi1P7rB K2PhaPfPL5b4nI5++lQsQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1695942963; x=1696029363; bh=V HL3K3RZ6/F72JVZUkxSZ3tzq++vFi+1nAyKppki0Dw=; b=UTJvTibAEM9WfDnz9 3MFoYJ3e4UNHO/k8G2p7PUTbT9e2ni/UBCRGmEAl+iGLPGSu1oC8oZOb30bSdT18 V12HIDS+nVf8C11vTM/KgbHogDErAAYyKHBQfOWi1WJPt2FjhQVuh0IFo1ODoJSx uobgIK4Ei1vIuKOIn+9J8Ctzat/6F4/Yd+jLj7cmz2HyFqtItfeiGJCInIBzbbNj kWy97hJn7xgD24xmCq+qn7cmZ6w1FdpAkdKWKSHeISjvPqPVfEThyznnS6rea3Ob 6E1pfQ3mMcd2+2Tq0GnM/6Ip490xnMQRNlAXyBxTtazs+tICsf01x31iIW8G0Wuo Pthzw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrtddugddvudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeeuohhrihhsuceuuhhrkhhovhcuoegsohhrihhssegsuhhrrdhi oheqnecuggftrfgrthhtvghrnhepieeuffeuvdeiueejhfehiefgkeevudejjeejffevvd ehtddufeeihfekgeeuheelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomhepsghorhhishessghurhdrihho X-ME-Proxy: Feedback-ID: i083147f8:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 28 Sep 2023 19:16:02 -0400 (EDT) From: Boris Burkov To: linux-btrfs@vger.kernel.org, kernel-team@fb.com, fstests@vger.kernel.org Subject: [PATCH v4 4/6] btrfs: quota rescan helpers Date: Thu, 28 Sep 2023 16:16:46 -0700 Message-ID: <1f8549eb7f043ab9071faf896121896e759daab7.1695942727.git.boris@bur.io> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org Many btrfs tests explicitly trigger quota rescan. This is not a meaningful operation for simple quotas, so we wrap it in a helper that doesn't blow up quite so badly and lets us run those tests where the rescan is a qgroup detail. Signed-off-by: Boris Burkov Reviewed-by: Anand Jain --- common/btrfs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/common/btrfs b/common/btrfs index 8d51bd522..34fa3a157 100644 --- a/common/btrfs +++ b/common/btrfs @@ -710,6 +710,24 @@ _check_regular_qgroup() _qgroup_mode "$@" | grep -q 'qgroup' } +_qgroup_rescan() +{ + local mnt=$1 + local dev=$(findmnt -n -o SOURCE $mnt) + + _check_regular_qgroup $dev || return 1 + _run_btrfs_util_prog quota rescan -w $mnt +} + +_require_qgroup_rescan() +{ + _scratch_mkfs >>$seqres.full 2>&1 + _scratch_mount + _run_btrfs_util_prog quota enable $SCRATCH_MNT + $BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT || _notrun "not able to run quota rescan" + _scratch_unmount +} + _require_scratch_qgroup() { _scratch_mkfs >>$seqres.full 2>&1 From patchwork Thu Sep 28 23:16:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Burkov X-Patchwork-Id: 13403571 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AB85E743D5 for ; Thu, 28 Sep 2023 23:16:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230246AbjI1XQI (ORCPT ); Thu, 28 Sep 2023 19:16:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231790AbjI1XQI (ORCPT ); Thu, 28 Sep 2023 19:16:08 -0400 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5B36AC; Thu, 28 Sep 2023 16:16:05 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 2CDA55C013C; Thu, 28 Sep 2023 19:16:05 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 28 Sep 2023 19:16:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bur.io; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1695942965; x= 1696029365; bh=jRmpQnQRDBNFYsmZr9zixenkAAlEEq75rTWdTPQkDAw=; b=M i6dkTIJMx40+SQjAi8ntcfkmeRBJwgl4SOUyu/TXd+quD0xAhl8Eznxzmqj6IRxn lzXU/0PKWKPEWo7k22W9C+NUr8TCSbdmBDzRA1P2eYYYJoMy2afkeH4j4NOTekNA /9zSE949cWGYVeYKGNWRGohUEvXBqUrHIWoKEpLzCHaBJpCkBQLMVct+/czTThHl LpKj6oBVR9RLjKlrXn+W7mhEj7k0c1v1FlK0pSM1lns1Q/8wFJQq6C4+X2ncednK ZzNV8BANsZj8vXyQtLja7l++cCVP0jZmlF0QGCroLlps6Zf7t4Fv1b0702+QwWAk IrL/vdRTK+H7PdoRy6klQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1695942965; x=1696029365; bh=j RmpQnQRDBNFYsmZr9zixenkAAlEEq75rTWdTPQkDAw=; b=e3fJmO1uwdqm3z2DP KKjrEI70wR9ARHS67B0zWovQlsgcqoPyQOJ3y7wocWLLBofuFfbMI0gECbxyTWwH vYjlKOzaxBrmjLXwNi4o/swgqCK3HlCz6j3jxfYxbhPNDGP3cjUVzCY5uIMkk9/f 4qLjfezkA3O4yEGmgK0rESQgUuHYgUrAW5OfQmcBp9fsY3m7czv7S5aGtQkHp9Xp BFUZNpJLY2xiGbtO7qdcB2bDjgsQ2KNSS+aTKciuDffrZfw5bRtS+/6Oio6QqsE9 4RdygI113RqE+vfUyzpoauQ8HPsQhimk1+1/7lNsbosYveMW4CSu592vFw++e0Ex bNCGw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrtddugddvtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeeuohhrihhsuceuuhhrkhhovhcuoegsohhrihhssegsuhhrrdhi oheqnecuggftrfgrthhtvghrnhepieeuffeuvdeiueejhfehiefgkeevudejjeejffevvd ehtddufeeihfekgeeuheelnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehm rghilhhfrhhomhepsghorhhishessghurhdrihho X-ME-Proxy: Feedback-ID: i083147f8:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 28 Sep 2023 19:16:04 -0400 (EDT) From: Boris Burkov To: linux-btrfs@vger.kernel.org, kernel-team@fb.com, fstests@vger.kernel.org Subject: [PATCH v4 5/6] btrfs: use new rescan wrapper Date: Thu, 28 Sep 2023 16:16:47 -0700 Message-ID: <7264ca978836109af1be53f93153837ede2705da.1695942727.git.boris@bur.io> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org These tests can pass in simple quota mode if we skip the rescans via the wrapper. Signed-off-by: Boris Burkov Reviewed-by: Anand Jain --- tests/btrfs/022 | 1 + tests/btrfs/028 | 2 +- tests/btrfs/104 | 2 +- tests/btrfs/123 | 2 +- tests/btrfs/126 | 2 +- tests/btrfs/139 | 2 +- tests/btrfs/153 | 2 +- tests/btrfs/171 | 6 +++--- tests/btrfs/179 | 2 +- tests/btrfs/180 | 2 +- tests/btrfs/190 | 2 +- tests/btrfs/193 | 2 +- tests/btrfs/210 | 2 +- tests/btrfs/224 | 6 +++--- tests/btrfs/230 | 2 +- tests/btrfs/232 | 2 +- 16 files changed, 20 insertions(+), 19 deletions(-) diff --git a/tests/btrfs/022 b/tests/btrfs/022 index e2d37b094..b1ef2fdf7 100755 --- a/tests/btrfs/022 +++ b/tests/btrfs/022 @@ -14,6 +14,7 @@ _begin_fstest auto qgroup limit _supported_fs btrfs _require_scratch +_require_qgroup_rescan _require_btrfs_qgroup_report # Test to make sure we can actually turn it on and it makes sense diff --git a/tests/btrfs/028 b/tests/btrfs/028 index fe0678f86..c4080c950 100755 --- a/tests/btrfs/028 +++ b/tests/btrfs/028 @@ -25,7 +25,7 @@ _scratch_mkfs >/dev/null _scratch_mount _run_btrfs_util_prog quota enable $SCRATCH_MNT -_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT +_qgroup_rescan $SCRATCH_MNT # Increase the probability of generating de-refer extent, and decrease # other. diff --git a/tests/btrfs/104 b/tests/btrfs/104 index 499de6bfb..c9528eb13 100755 --- a/tests/btrfs/104 +++ b/tests/btrfs/104 @@ -94,7 +94,7 @@ _explode_fs_tree 1 $SCRATCH_MNT/snap2/files-snap2 # Enable qgroups now that we have our filesystem prepared. This # will kick off a scan which we will have to wait for. _run_btrfs_util_prog quota enable $SCRATCH_MNT -_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT +_qgroup_rescan $SCRATCH_MNT # Remount to clear cache, force everything to disk _scratch_cycle_mount diff --git a/tests/btrfs/123 b/tests/btrfs/123 index c179eeec9..4c5b7e116 100755 --- a/tests/btrfs/123 +++ b/tests/btrfs/123 @@ -39,7 +39,7 @@ sync # enable quota and rescan to get correct number _run_btrfs_util_prog quota enable $SCRATCH_MNT -_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT +_qgroup_rescan $SCRATCH_MNT # now balance data block groups to corrupt qgroup _run_btrfs_balance_start -d $SCRATCH_MNT >> $seqres.full diff --git a/tests/btrfs/126 b/tests/btrfs/126 index 2b0edb65b..1bb24e00f 100755 --- a/tests/btrfs/126 +++ b/tests/btrfs/126 @@ -28,7 +28,7 @@ _scratch_mkfs >/dev/null _scratch_mount "-o enospc_debug" _run_btrfs_util_prog quota enable $SCRATCH_MNT -_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT +_qgroup_rescan $SCRATCH_MNT _run_btrfs_util_prog qgroup limit 512K 0/5 $SCRATCH_MNT # The amount of written data may change due to different nodesize at mkfs time, diff --git a/tests/btrfs/139 b/tests/btrfs/139 index c4b09f9fc..f3d92ba46 100755 --- a/tests/btrfs/139 +++ b/tests/btrfs/139 @@ -30,7 +30,7 @@ SUBVOL=$SCRATCH_MNT/subvol _run_btrfs_util_prog subvolume create $SUBVOL _run_btrfs_util_prog quota enable $SCRATCH_MNT -_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT +_qgroup_rescan $SCRATCH_MNT _run_btrfs_util_prog qgroup limit -e 1G $SUBVOL # Write and delete files within 1G limits, multiple times diff --git a/tests/btrfs/153 b/tests/btrfs/153 index 99fab1018..4a5fe2b8c 100755 --- a/tests/btrfs/153 +++ b/tests/btrfs/153 @@ -24,7 +24,7 @@ _scratch_mkfs >/dev/null _scratch_mount _run_btrfs_util_prog quota enable $SCRATCH_MNT -_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT +_qgroup_rescan $SCRATCH_MNT _run_btrfs_util_prog qgroup limit 100M 0/5 $SCRATCH_MNT testfile1=$SCRATCH_MNT/testfile1 diff --git a/tests/btrfs/171 b/tests/btrfs/171 index 461cdd0fa..6a1ed1c1a 100755 --- a/tests/btrfs/171 +++ b/tests/btrfs/171 @@ -35,7 +35,7 @@ $BTRFS_UTIL_PROG subvolume snapshot "$SCRATCH_MNT/subvol" \ "$SCRATCH_MNT/snapshot" > /dev/null $BTRFS_UTIL_PROG quota enable "$SCRATCH_MNT" > /dev/null -$BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null +_qgroup_rescan $SCRATCH_MNT > /dev/null # Create high level qgroup $BTRFS_UTIL_PROG qgroup create 1/0 "$SCRATCH_MNT" @@ -45,7 +45,7 @@ $BTRFS_UTIL_PROG qgroup assign "$SCRATCH_MNT/snapshot" 1/0 "$SCRATCH_MNT" \ # Above assignment will mark qgroup inconsistent due to the shared extents # between subvol/snapshot/high level qgroup, do rescan here. -$BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null +_qgroup_rescan $SCRATCH_MNT > /dev/null # Now remove the qgroup relationship and make 1/0 childless # Due to the shared extent outside of 1/0, we will mark qgroup inconsistent @@ -54,7 +54,7 @@ $BTRFS_UTIL_PROG qgroup remove "$SCRATCH_MNT/snapshot" 1/0 "$SCRATCH_MNT" \ 2>&1 | _filter_btrfs_qgroup_assign_warnings # Above removal also marks qgroup inconsistent, rescan again -$BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null +_qgroup_rescan $SCRATCH_MNT > /dev/null # After the test, btrfs check will verify qgroup numbers to catch any # corruption. diff --git a/tests/btrfs/179 b/tests/btrfs/179 index 479667f05..00013af0a 100755 --- a/tests/btrfs/179 +++ b/tests/btrfs/179 @@ -33,7 +33,7 @@ _scratch_mount mkdir -p "$SCRATCH_MNT/snapshots" $BTRFS_UTIL_PROG subvolume create "$SCRATCH_MNT/src" > /dev/null $BTRFS_UTIL_PROG quota enable "$SCRATCH_MNT" > /dev/null -$BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null +_qgroup_rescan "$SCRATCH_MNT" > /dev/null fill_workload() { diff --git a/tests/btrfs/180 b/tests/btrfs/180 index b7c8dac96..aa195f7b4 100755 --- a/tests/btrfs/180 +++ b/tests/btrfs/180 @@ -27,7 +27,7 @@ _scratch_mkfs > /dev/null _scratch_mount $BTRFS_UTIL_PROG quota enable "$SCRATCH_MNT" > /dev/null -$BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null +_qgroup_rescan "$SCRATCH_MNT" > /dev/null $BTRFS_UTIL_PROG qgroup limit -e 1G "$SCRATCH_MNT" $XFS_IO_PROG -f -c "falloc 0 900M" "$SCRATCH_MNT/padding" diff --git a/tests/btrfs/190 b/tests/btrfs/190 index 974438c15..f78c14fe4 100755 --- a/tests/btrfs/190 +++ b/tests/btrfs/190 @@ -30,7 +30,7 @@ _log_writes_mkfs >> $seqres.full 2>&1 _log_writes_mount $BTRFS_UTIL_PROG quota enable $SCRATCH_MNT >> $seqres.full -$BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full +_qgroup_rescan $SCRATCH_MNT >> $seqres.full # Create enough metadata for later balance for ((i = 0; i < $nr_files; i++)); do diff --git a/tests/btrfs/193 b/tests/btrfs/193 index b4632ab0a..67220c7a5 100755 --- a/tests/btrfs/193 +++ b/tests/btrfs/193 @@ -26,7 +26,7 @@ _scratch_mkfs > /dev/null _scratch_mount $BTRFS_UTIL_PROG quota enable "$SCRATCH_MNT" > /dev/null -$BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null +_qgroup_rescan "$SCRATCH_MNT" > /dev/null $BTRFS_UTIL_PROG qgroup limit -e 256M "$SCRATCH_MNT" # Create a file with the following layout: diff --git a/tests/btrfs/210 b/tests/btrfs/210 index 383a307ff..f3d769fa0 100755 --- a/tests/btrfs/210 +++ b/tests/btrfs/210 @@ -29,7 +29,7 @@ _pwrite_byte 0xcd 0 16M "$SCRATCH_MNT/src/file" > /dev/null # by qgroup sync $BTRFS_UTIL_PROG quota enable "$SCRATCH_MNT" -$BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null +_qgroup_rescan "$SCRATCH_MNT" > /dev/null $BTRFS_UTIL_PROG qgroup create 1/0 "$SCRATCH_MNT" # Create a snapshot with qgroup inherit diff --git a/tests/btrfs/224 b/tests/btrfs/224 index d7ec57360..de10942fe 100755 --- a/tests/btrfs/224 +++ b/tests/btrfs/224 @@ -30,7 +30,7 @@ assign_shared_test() echo "=== qgroup assign shared test ===" >> $seqres.full $BTRFS_UTIL_PROG quota enable $SCRATCH_MNT - $BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full + _qgroup_rescan $SCRATCH_MNT >> $seqres.full $BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/a >> $seqres.full $BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/b >> $seqres.full @@ -54,7 +54,7 @@ assign_no_shared_test() echo "=== qgroup assign no shared test ===" >> $seqres.full $BTRFS_UTIL_PROG quota enable $SCRATCH_MNT - $BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full + _qgroup_rescan $SCRATCH_MNT >> $seqres.full $BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/a >> $seqres.full $BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/b >> $seqres.full @@ -75,7 +75,7 @@ snapshot_test() echo "=== qgroup snapshot test ===" >> $seqres.full $BTRFS_UTIL_PROG quota enable $SCRATCH_MNT - $BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full + _qgroup_rescan $SCRATCH_MNT >> $seqres.full $BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/a >> $seqres.full _ddt of="$SCRATCH_MNT"/a/file1 bs=1M count=1 >> $seqres.full 2>&1 diff --git a/tests/btrfs/230 b/tests/btrfs/230 index 46b0c6369..7a4cd18e9 100755 --- a/tests/btrfs/230 +++ b/tests/btrfs/230 @@ -31,7 +31,7 @@ _pwrite_byte 0xcd 0 1G $SCRATCH_MNT/file >> $seqres.full sync $BTRFS_UTIL_PROG quota enable $SCRATCH_MNT -$BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full +_qgroup_rescan $SCRATCH_MNT >> $seqres.full # Set the limit to just 512MiB, which is way below the existing usage $BTRFS_UTIL_PROG qgroup limit 512M 0/5 $SCRATCH_MNT diff --git a/tests/btrfs/232 b/tests/btrfs/232 index 02c7e49de..debe070bb 100755 --- a/tests/btrfs/232 +++ b/tests/btrfs/232 @@ -46,7 +46,7 @@ _pwrite_byte 0xcd 0 900m $SCRATCH_MNT/file >> $seqres.full sync $BTRFS_UTIL_PROG quota enable $SCRATCH_MNT -$BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full +_qgroup_rescan $SCRATCH_MNT >> $seqres.full # set the limit to 1 g, leaving us just 100mb of slack space $BTRFS_UTIL_PROG qgroup limit 1G 0/5 $SCRATCH_MNT From patchwork Thu Sep 28 23:16:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Burkov X-Patchwork-Id: 13403570 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82BDBE743D7 for ; Thu, 28 Sep 2023 23:16:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231790AbjI1XQK (ORCPT ); Thu, 28 Sep 2023 19:16:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231890AbjI1XQJ (ORCPT ); Thu, 28 Sep 2023 19:16:09 -0400 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EBAA19E; Thu, 28 Sep 2023 16:16:07 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id DE3D65C0130; Thu, 28 Sep 2023 19:16:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 28 Sep 2023 19:16:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bur.io; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1695942966; x= 1696029366; bh=IJ1AtBs/+gvrd7LgN9ORPYT44X0HNrNvDB6Q80vzeH0=; b=a vn9i9ZJSaXN5/v1SKAEVoaaSoSOBTpnRvp2Ri2mEtbezx+PM53rr6ho+yiGfJQey zdCNWh/FVsjm/a6d9QWSnQqMBWxAVNv5wzvJkt2ZHcsvBPhSoJRzoL1P1t2A+7OI 9E2CaQcuqaSHBtXyQPsITZ5p4QxDR/lhD7/KTpJwVljfB9qEiQqY+DQ8l9COxlCd lR4w1ae7CygMlt3WlanqF2KNCnmzsD5j0qEJ1hFwGJg8d/e1WY1i2BGO8O/jTHg6 62h+HvDQ7wrR6co7Rfupt8aD29/JfhTuR+jzWbpabt3R0Z3gF+bxj+oubq0lHXmA XDUasKCI3GkEkhPcuTZSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1695942966; x=1696029366; bh=I J1AtBs/+gvrd7LgN9ORPYT44X0HNrNvDB6Q80vzeH0=; b=ijXznA//kwP/7awba jzMomBpmPqRlm2oI5Etw0+UQInknyAWnOqVkLtvoqhRxMjqLyiCcmmdyZWcOn4jw UbapNzAmAy3+gLqy2WuGBtjziOzh8ZobBt8ubQk40OKD/9z0KNIbC7X2hQOn6d3L mX9MJ3W3zRfojOCWvuks6akpzj2i4B9R97StmFnoxCYvD3/6ntr7W3qlyEvrbCKt SnwSVTMGmnwkWtY02H9NjiKR6SL2kku92LGeoPfWY5M0bWRyStvPdd1Z7mriotY0 jUGM8M59S091jt5iH8OgDnUJCdYq5s4wgZPGD0fEeW4tKlaeGR3XTc8C23MtX5fx xxhoA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrtddugddvudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeeuohhrihhsuceuuhhrkhhovhcuoegsohhrihhssegsuhhrrdhi oheqnecuggftrfgrthhtvghrnhepieeuffeuvdeiueejhfehiefgkeevudejjeejffevvd ehtddufeeihfekgeeuheelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomhepsghorhhishessghurhdrihho X-ME-Proxy: Feedback-ID: i083147f8:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 28 Sep 2023 19:16:06 -0400 (EDT) From: Boris Burkov To: linux-btrfs@vger.kernel.org, kernel-team@fb.com, fstests@vger.kernel.org Subject: [PATCH v4 6/6] btrfs: skip squota incompatible tests Date: Thu, 28 Sep 2023 16:16:48 -0700 Message-ID: <32ac4b162efb7356eb02398446f9cc082344436f.1695942727.git.boris@bur.io> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org These tests cannot succeed if mkfs enable squotas, as they either test the specifics of qgroups behavior or they test *enabling* squotas. Skip these in squota mode. Signed-off-by: Boris Burkov --- tests/btrfs/017 | 1 + tests/btrfs/057 | 1 + tests/btrfs/091 | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/btrfs/017 b/tests/btrfs/017 index 622071018..496cc7df1 100755 --- a/tests/btrfs/017 +++ b/tests/btrfs/017 @@ -22,6 +22,7 @@ _begin_fstest auto quick qgroup _supported_fs btrfs _require_scratch +_require_scratch_qgroup _require_cloner # Currently in btrfs the node/leaf size can not be smaller than the page diff --git a/tests/btrfs/057 b/tests/btrfs/057 index 782d854a0..e932a6572 100755 --- a/tests/btrfs/057 +++ b/tests/btrfs/057 @@ -15,6 +15,7 @@ _begin_fstest auto quick # real QA test starts here _supported_fs btrfs _require_scratch +_require_qgroup_rescan _scratch_mkfs_sized $((1024 * 1024 * 1024)) >> $seqres.full 2>&1 diff --git a/tests/btrfs/091 b/tests/btrfs/091 index f2cd00b2e..a71e03406 100755 --- a/tests/btrfs/091 +++ b/tests/btrfs/091 @@ -19,6 +19,7 @@ _begin_fstest auto quick qgroup _supported_fs btrfs _require_scratch _require_cp_reflink +_require_scratch_qgroup # use largest node/leaf size (64K) to allow the test to be run on arch with # page size > 4k. @@ -35,7 +36,7 @@ _run_btrfs_util_prog subvolume create $SCRATCH_MNT/subv2 _run_btrfs_util_prog subvolume create $SCRATCH_MNT/subv3 _run_btrfs_util_prog quota enable $SCRATCH_MNT -_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT +_qgroup_rescan $SCRATCH_MNT $XFS_IO_PROG -f -c "pwrite 0 256K" $SCRATCH_MNT/subv1/file1 | _filter_xfs_io cp --reflink $SCRATCH_MNT/subv1/file1 $SCRATCH_MNT/subv2/file1