From patchwork Wed Jul 5 23:42:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Burkov X-Patchwork-Id: 13303058 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 7908EC001E0 for ; Wed, 5 Jul 2023 23:43:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232138AbjGEXnk (ORCPT ); Wed, 5 Jul 2023 19:43:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231921AbjGEXnk (ORCPT ); Wed, 5 Jul 2023 19:43:40 -0400 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62A5B129; Wed, 5 Jul 2023 16:43:39 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id D2B605C0219; Wed, 5 Jul 2023 19:43:38 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 05 Jul 2023 19:43:38 -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=1688600618; x= 1688687018; bh=+i6Cr6FLp8Jnxqu3nf2JljcSF75fpl4+hJuCRs9uTKw=; b=g tb7Q2GsFwR183atTG+RiaTyz3azBE0lXwbF+wHqgZdC6TrmwJUm/ACYd5mJQqr4T r/aHfsTRjePuKSNFg3f7rqmnApljDUWFvV1TjC+Npxc7sQGLkNTMqUu43FUPKC9+ A2p1Iie4rNSl4hE2lUjN5P0uwvxI2Tjb/JE+RYMpCQH71rO/2LfxAxkUs1MbTh0+ 1ekqwmUBIgmjTgF9wvnd4xyTjhsp8mtqy6V8nQT2xrDfkY8IivpNSf7AOd4rwdHQ dqcCdz3oKvyzIcrpvQH4xuKRtAiysTF92QABo+1BSry7zAID51nUPAEMbtrDpzqL HKYQqmzJCs65LcxomTL7w== 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=1688600618; x=1688687018; bh=+ i6Cr6FLp8Jnxqu3nf2JljcSF75fpl4+hJuCRs9uTKw=; b=LPuRfZ9OGdSwkvj4Z n3JU0Nq1Lw9uTCK1Yg9nm3OXf79rebIbcaggoW+QTonJLzNXyKEG7GSz5LIsBZhd HO53ipL7HNDxUi+G+GQS0ll3uaUZ2Kl2uYMhFqrB6lgwWch5iEiJMnmjZP+aVZPZ H41phVVstadcw4wtZ5nj3kWT1UGIiepFk9tT3bhkzYyZEAUcLimbRzS32mkDjN2L BYD/1pqx+1OkJkIoLswA78pwOMm8go+SN4ykR9Ooci0MWUa6xZwMxtHiPfttGrcl 6CHFi3FDuwGxxfBHdmpCqHEaSLcyL9O5FaowWRrBZwQBp6+bYuWCgCpIikuIEHLb 1HI/A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudekgddvhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeeuohhrihhsuceuuhhrkhhovhcuoegsohhrihhssegsuhhrrdhi oheqnecuggftrfgrthhtvghrnhepieeuffeuvdeiueejhfehiefgkeevudejjeejffevvd ehtddufeeihfekgeeuheelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomhepsghorhhishessghurhdrihho X-ME-Proxy: Feedback-ID: i083147f8:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 5 Jul 2023 19:43:38 -0400 (EDT) From: Boris Burkov To: linux-btrfs@vger.kernel.org, kernel-team@fb.com, fstests@vger.kernel.org Subject: [PATCH 3/5] common/btrfs: quota rescan helpers Date: Wed, 5 Jul 2023 16:42:25 -0700 Message-ID: <0e9cb76f3ddad71bb36b70464b62423b77fd6399.1688600422.git.boris@bur.io> X-Mailer: git-send-email 2.41.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 --- common/btrfs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/common/btrfs b/common/btrfs index 66c065a10..d88feaded 100644 --- a/common/btrfs +++ b/common/btrfs @@ -715,6 +715,31 @@ _qgroup_mode() fi } +_check_regular_qgroup() +{ + local mnt=$1 + + _qgroup_mode $mnt | grep -q 'qgroup' +} + +_qgroup_rescan() +{ + local mnt=$1 + + _check_regular_qgroup $mnt || 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