From patchwork Fri Dec 30 22:20:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085825 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 F3B0BC4332F for ; Sat, 31 Dec 2022 03:09:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236317AbiLaDJq (ORCPT ); Fri, 30 Dec 2022 22:09:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236304AbiLaDJp (ORCPT ); Fri, 30 Dec 2022 22:09:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE2731054D; Fri, 30 Dec 2022 19:09:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8B34F61D43; Sat, 31 Dec 2022 03:09:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEFEEC433EF; Sat, 31 Dec 2022 03:09:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456184; bh=2ults4eSPPu2CQwu9Ox3S3rmD1ptyWG0E9hpnInd/tA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=nZRcvlT99NskIlyCKfPMEceyMCJoR/qJVyUqtzhN1121Mf+x6FLO/ho3vxRF8F7pS 3ttskirz/w7hqawFINy9K3ukkpZsUWPbbWlAUdSwlha3Ex+O6EfF9CuGfbDQe9jneh 0ATPeSqEaAONG1RGZX/qr34T13vEU2XWoaadtAEUdWS27aSfoqrOzNiUGod5KRBF5I dQmbto58ngy8uOzjygA99x0ktKTxZh2kQXVdjTB8BKhEoQUmLPzfrTLjWrxsWf4/qr zvZ0Apy8EvXJF/ZkjYwU39dgEMfglcirlrUc82PKyfp+MwALWvIxA/QGgfT2Zc+aQB N3uxM6GuxF3fg== Subject: [PATCH 01/12] xfs/122: update for rtgroups From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:39 -0800 Message-ID: <167243883960.739029.13358901178644202496.stgit@magnolia> In-Reply-To: <167243883943.739029.3041109696120604285.stgit@magnolia> References: <167243883943.739029.3041109696120604285.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Add our new metadata for realtime allocation groups to the ondisk checking. Signed-off-by: Darrick J. Wong --- tests/xfs/122.out | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index eee6c1ee6d..01376180cc 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -44,6 +44,9 @@ offsetof(xfs_sb_t, sb_rbmino) = 64 offsetof(xfs_sb_t, sb_rextents) = 24 offsetof(xfs_sb_t, sb_rextsize) = 80 offsetof(xfs_sb_t, sb_rextslog) = 125 +offsetof(xfs_sb_t, sb_rgblklog) = 280 +offsetof(xfs_sb_t, sb_rgblocks) = 272 +offsetof(xfs_sb_t, sb_rgcount) = 276 offsetof(xfs_sb_t, sb_rootino) = 56 offsetof(xfs_sb_t, sb_rrmapino) = 264 offsetof(xfs_sb_t, sb_rsumino) = 72 @@ -112,9 +115,11 @@ sizeof(struct xfs_refcount_key) = 4 sizeof(struct xfs_refcount_rec) = 12 sizeof(struct xfs_rmap_key) = 20 sizeof(struct xfs_rmap_rec) = 24 +sizeof(struct xfs_rtgroup_geometry) = 128 sizeof(struct xfs_rtrmap_key) = 24 sizeof(struct xfs_rtrmap_rec) = 32 sizeof(struct xfs_rtrmap_root) = 4 +sizeof(struct xfs_rtsb) = 104 sizeof(struct xfs_rud_log_format) = 16 sizeof(struct xfs_rui_log_format) = 16 sizeof(struct xfs_scrub_metadata) = 64 From patchwork Fri Dec 30 22:20:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085826 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 5016BC3DA7C for ; Sat, 31 Dec 2022 03:10:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236286AbiLaDKB (ORCPT ); Fri, 30 Dec 2022 22:10:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236259AbiLaDKB (ORCPT ); Fri, 30 Dec 2022 22:10:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81EC51054D; Fri, 30 Dec 2022 19:10:00 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1C3D161CFF; Sat, 31 Dec 2022 03:10:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C07DC433F0; Sat, 31 Dec 2022 03:09:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456199; bh=ZAmV0qeIna3RO54L+knjByCCv3gz5nrG33VZjLMC66M=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=uREiY+JlUFUk0QCt8jpDEUtVHM7qmc3kqiSoAJOpudnRQprnhljG+ufE8GPnJwnn6 sSLPTzBVUSn4+pNH9vuuuVEQNcuEHIKpH/cScmw6mae8BxSJUDKvWlEmMtf9B0HNuS sGZ+c/r0iZ0JQ0FmL7u19WDqJjDdFwvIDnQgpKzJZAa2n99RlnNog8x1fu47wJwmkn 4kOiSqA1ULiaf1Yb3Dngm4cHDVpoyfNNBXfzRuDZC1sHcPiKH8j9Tl8eXgUt3FPRgN Vu+nr8LOoz1RXqbHXEwal/qMc8JmJv5gHmpSsD0jTYip+gX8qKqnvnoQ1l+S7OhYmS 3553BpyJYuuUA== Subject: [PATCH 02/12] punch-alternating: detect xfs realtime files with large allocation units From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:39 -0800 Message-ID: <167243883973.739029.13588431902885797694.stgit@magnolia> In-Reply-To: <167243883943.739029.3041109696120604285.stgit@magnolia> References: <167243883943.739029.3041109696120604285.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong For files on the XFS realtime volume, it's possible that the file allocation unit (aka the minimum size we have to punch to deallocate file blocks) could be greater than a single fs block. This utility assumed that it's always possible to punch a single fs block, but for these types of files, all that does is zeroes the page cache. While that's what most *user applications* want, fstests uses punching to fragment file mapping metadata and/or fragment free space, so adapt this test for that purpose by detecting realtime files. Signed-off-by: Darrick J. Wong --- src/punch-alternating.c | 28 +++++++++++++++++++++++++++- tests/xfs/114 | 4 ++++ tests/xfs/146 | 2 +- tests/xfs/187 | 3 ++- tests/xfs/341 | 4 ++-- 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/punch-alternating.c b/src/punch-alternating.c index 18dd215197..d2bb4b6a22 100644 --- a/src/punch-alternating.c +++ b/src/punch-alternating.c @@ -20,6 +20,28 @@ void usage(char *cmd) exit(1); } +/* Compute the file allocation unit size for an XFS file. */ +static int detect_xfs_alloc_unit(int fd) +{ + struct fsxattr fsx; + struct xfs_fsop_geom fsgeom; + int ret; + + ret = ioctl(fd, XFS_IOC_FSGEOMETRY, &fsgeom); + if (ret) + return -1; + + ret = ioctl(fd, XFS_IOC_FSGETXATTR, &fsx); + if (ret) + return -1; + + ret = fsgeom.blocksize; + if (fsx.fsx_xflags & XFS_XFLAG_REALTIME) + ret *= fsgeom.rtextsize; + + return ret; +} + int main(int argc, char *argv[]) { struct stat s; @@ -82,7 +104,11 @@ int main(int argc, char *argv[]) goto err; sz = s.st_size; - blksz = sf.f_bsize; + c = detect_xfs_alloc_unit(fd); + if (c > 0) + blksz = c; + else + blksz = sf.f_bsize; mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE; for (offset = start_offset * blksz; diff --git a/tests/xfs/114 b/tests/xfs/114 index 0e8a0529ab..7ecb4d217c 100755 --- a/tests/xfs/114 +++ b/tests/xfs/114 @@ -49,6 +49,10 @@ $XFS_IO_PROG -f \ -c "pwrite -S 0x68 -b 1048576 0 $len2" \ $SCRATCH_MNT/f2 >> $seqres.full +# The arguments to punch-alternating must be specified in units of file +# allocation units, so we divide the argument by $file_blksz. We already +# verified that $blksz is congruent with $file_blksz, so the fpunch parameters +# will always align with the file allocation unit. $here/src/punch-alternating -o $((16 * blksz / file_blksz)) \ -s $((blksz / file_blksz)) \ -i $((blksz * 2 / file_blksz)) \ diff --git a/tests/xfs/146 b/tests/xfs/146 index 123bdff59f..c1ef5e7e1b 100755 --- a/tests/xfs/146 +++ b/tests/xfs/146 @@ -68,7 +68,7 @@ _xfs_force_bdev realtime $SCRATCH_MNT # Allocate some stuff at the start, to force the first falloc of the ouch file # to happen somewhere in the middle of the rt volume $XFS_IO_PROG -f -c 'falloc 0 64m' "$SCRATCH_MNT/b" -$here/src/punch-alternating -i $((rextblks * 2)) -s $((rextblks)) "$SCRATCH_MNT/b" +$here/src/punch-alternating "$SCRATCH_MNT/b" avail="$(df -P "$SCRATCH_MNT" | awk 'END {print $4}')"1 toobig="$((avail * 2))" diff --git a/tests/xfs/187 b/tests/xfs/187 index 7c34d8e630..14c3b37670 100755 --- a/tests/xfs/187 +++ b/tests/xfs/187 @@ -132,7 +132,8 @@ $XFS_IO_PROG -f -c "truncate $required_sz" -c "falloc 0 $remap_sz" $SCRATCH_MNT/ # Punch out every other extent of the last two sections, to fragment free space. frag_sz=$((remap_sz * 3)) punch_off=$((bigfile_sz - frag_sz)) -$here/src/punch-alternating $SCRATCH_MNT/bigfile -o $((punch_off / fsbsize)) -i $((rtextsize_blks * 2)) -s $rtextsize_blks +rtextsize_bytes=$((fsbsize * rtextsize_blks)) +$here/src/punch-alternating $SCRATCH_MNT/bigfile -o $((punch_off / rtextsize_bytes)) # Make sure we have some free rtextents. free_rtx=$($XFS_IO_PROG -c 'statfs' $SCRATCH_MNT | grep statfs.f_bavail | awk '{print $3}') diff --git a/tests/xfs/341 b/tests/xfs/341 index 1f734c9015..7d2842b579 100755 --- a/tests/xfs/341 +++ b/tests/xfs/341 @@ -43,8 +43,8 @@ len=$((blocks * rtextsz)) echo "Create some files" $XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full $XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full -$here/src/punch-alternating -i $((2 * rtextsz_blks)) -s $rtextsz_blks $SCRATCH_MNT/f1 >> "$seqres.full" -$here/src/punch-alternating -i $((2 * rtextsz_blks)) -s $rtextsz_blks $SCRATCH_MNT/f2 >> "$seqres.full" +$here/src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" +$here/src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" echo garbage > $SCRATCH_MNT/f3 ino=$(stat -c '%i' $SCRATCH_MNT/f3) _scratch_unmount From patchwork Fri Dec 30 22:20:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085827 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 20150C4332F for ; Sat, 31 Dec 2022 03:10:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236306AbiLaDKT (ORCPT ); Fri, 30 Dec 2022 22:10:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236304AbiLaDKR (ORCPT ); Fri, 30 Dec 2022 22:10:17 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1395F10540; Fri, 30 Dec 2022 19:10:16 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A2CE361CFF; Sat, 31 Dec 2022 03:10:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FD5BC433F0; Sat, 31 Dec 2022 03:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456215; bh=BpaBDjKCvZQ+wAUI1pEUjtOo2RP/+hrK1stKhpKlLgU=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Ek8tU484DLMWEQa54KSHPlDz/k78/5490yszOHIkEatZmZ+ImiQEMJ3GtIzp5tt2b 3ny8WmGh4kj3GxyxDDcg/2L3DMi9yLS4eVkXITV0HvM3CtWgRYfBGFkbY327M78oFe bU6xu+jeMY3XVYUnmsZSR4ZrioXnJwpeI1K7a+BmE5qZciN5aGVZuBXI3KbHMOjmfX dFK2ndVBT3j1y0/roQO1QOucFInHHNvK3ljBGwKExaQxtYvnaj5/1SPFOxti0QZldi nCCtyXvDVuybm16QTaCUB12Oqba1ayRmqwWU6vDHicEeweqKWQi9jS4v53q4EphQL3 UcnQluqrdSGvg== Subject: [PATCH 03/12] xfs/206: update mkfs filtering for rt groups feature From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:39 -0800 Message-ID: <167243883987.739029.11440531374025755858.stgit@magnolia> In-Reply-To: <167243883943.739029.3041109696120604285.stgit@magnolia> References: <167243883943.739029.3041109696120604285.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Filter out the new mkfs lines that show the rtgroup information, since this test is heavily dependent on old mkfs output. Signed-off-by: Darrick J. Wong --- tests/xfs/206 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/xfs/206 b/tests/xfs/206 index c181d7dd3e..904d53deb0 100755 --- a/tests/xfs/206 +++ b/tests/xfs/206 @@ -65,7 +65,8 @@ mkfs_filter() -e "s/, lazy-count=[0-9]//" \ -e "/.*crc=/d" \ -e "/^Default configuration/d" \ - -e "/metadir=.*/d" + -e "/metadir=.*/d" \ + -e '/rgcount=/d' } # mkfs slightly smaller than that, small log for speed. From patchwork Fri Dec 30 22:20:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085828 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 B7676C4332F for ; Sat, 31 Dec 2022 03:10:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236304AbiLaDKd (ORCPT ); Fri, 30 Dec 2022 22:10:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236259AbiLaDKc (ORCPT ); Fri, 30 Dec 2022 22:10:32 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D6EB10540; Fri, 30 Dec 2022 19:10:31 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3A32A61D07; Sat, 31 Dec 2022 03:10:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92A08C433D2; Sat, 31 Dec 2022 03:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456230; bh=iazQdORJNTiNeT1Bp91lybOGz7rdHR5iUv8jJ2e1ZXQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=nRYM/XcVDr6we5jjicMUgSpay9hmf42UCTss4c8FXdx9lYOQeQVaFkr73YcO1vlv/ 2YbJh98r8aSy53O0kz6tlytP8WQtWIq1sksN6Uu/faw3aq1OkkTowbB7KhqCeKNLok 4vX5O9aveiCu3C5e97n6zFXjpJwK5ohW9QLbrpSlrrTGmLb7UWMGuyIQSnCuhkGj8d nXmLjckhchJd5tSgZ5CEMyJEDrG3W223DM+vddeymz/iSkyJbhvqjvN10DwKuzxAX8 tbQECYLWXAp04K8P3XvdoNaN+rUznlgCL4jp2BpiayiAs1D7KxfvmSi+DIZgSAIDtY vfylIq3OWTi1w== Subject: [PATCH 04/12] common: pass the realtime device to xfs_db when possible From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:40 -0800 Message-ID: <167243883999.739029.2059552910043982016.stgit@magnolia> In-Reply-To: <167243883943.739029.3041109696120604285.stgit@magnolia> References: <167243883943.739029.3041109696120604285.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Teach xfstests to pass the realtime device to xfs_db when it supports that option. Signed-off-by: Darrick J. Wong --- common/xfs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/common/xfs b/common/xfs index 36e02413db..0d1e0ec4bc 100644 --- a/common/xfs +++ b/common/xfs @@ -281,10 +281,10 @@ _xfs_check() { OPTS=" " DBOPTS=" " - USAGE="Usage: xfs_check [-fsvV] [-l logdev] [-i ino]... [-b bno]... special" + USAGE="Usage: xfs_check [-fsvV] [-l logdev] [-R rtdev] [-i ino]... [-b bno]... special" OPTIND=1 - while getopts "b:fi:l:stvV" c; do + while getopts "b:fi:l:stvVR:" c; do case $c in s) OPTS=$OPTS"-s ";; t) OPTS=$OPTS"-t ";; @@ -296,12 +296,14 @@ _xfs_check() V) $XFS_DB_PROG -p xfs_check -V return $? ;; + R) DBOPTS="$DBOPTS -R $OPTARG";; esac done set -- extra $@ shift $OPTIND case $# in - 1) ${XFS_DB_PROG}${DBOPTS} -F -i -p xfs_check -c "check$OPTS" $1 + 1) echo "${XFS_DB_PROG}${DBOPTS} -F -i -p xfs_check -c check$OPTS $1" >> /dev/ttyprintk + ${XFS_DB_PROG}${DBOPTS} -F -i -p xfs_check -c "check$OPTS" $1 status=$? ;; 2) echo $USAGE 1>&1 @@ -339,6 +341,11 @@ _scratch_xfs_db_options() SCRATCH_OPTIONS="" [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV" + if [ "$USE_EXTERNAL" = yes ] && [ ! -z "$SCRATCH_RTDEV" ]; then + $XFS_DB_PROG --help 2>&1 | grep -q -- '-R rtdev' || \ + _notrun 'xfs_db does not support rt devices' + SCRATCH_OPTIONS="$SCRATCH_OPTIONS -R$SCRATCH_RTDEV" + fi echo $SCRATCH_OPTIONS $* $SCRATCH_DEV } @@ -403,6 +410,11 @@ _scratch_xfs_check() SCRATCH_OPTIONS="-l $SCRATCH_LOGDEV" [ "$LARGE_SCRATCH_DEV" = yes ] && \ SCRATCH_OPTIONS=$SCRATCH_OPTIONS" -t" + if [ "$USE_EXTERNAL" = yes ] && [ ! -z "$SCRATCH_RTDEV" ]; then + $XFS_DB_PROG --help 2>&1 | grep -q -- '-R rtdev' || \ + _notrun 'xfs_db does not support rt devices' + SCRATCH_OPTIONS="$SCRATCH_OPTIONS -R$SCRATCH_RTDEV" + fi _xfs_check $SCRATCH_OPTIONS $* $SCRATCH_DEV } From patchwork Fri Dec 30 22:20:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085829 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 40E40C4332F for ; Sat, 31 Dec 2022 03:10:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236230AbiLaDKu (ORCPT ); Fri, 30 Dec 2022 22:10:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236307AbiLaDKs (ORCPT ); Fri, 30 Dec 2022 22:10:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 340A6C7D; Fri, 30 Dec 2022 19:10:47 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BE62D61C7A; Sat, 31 Dec 2022 03:10:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26016C433D2; Sat, 31 Dec 2022 03:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456246; bh=SaTtuIDKWjtXJHTCqaBfB3+SSvG07GWba4d4SvzcejE=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=f1PPDlPmUq5Xu6o7C1qex0Lt7D6sW22TikTeHu0QygTf3Kb2RQrKn9V7xEcudtPdS OqlxjLne8za9L6BaojbSbmJU8MdvvS6zi9mqdIe8KzmhFq7f62uOV/dXM/5Zgnh00t lwSPldp3EnWmpRreDGLdW+UMOfDbAZeF3qc9qesVbHbvh+WZl2oqLkZqavySSLoaSU qHApDAMRL/CjZQ/rVpk4Aj2XG86KC8GSKNqMYAjAkrDLDwG+kLCB1G4xskoQBhXeRH Kj97NB/OrTdiXbFEM5f5XujAHoklTHTNRhkAQbeVx5wfF/ev2MKTEWB1X0AV9kNwC2 ueMrsrRtZMmeg== Subject: [PATCH 05/12] common: filter rtgroups when we're disabling metadir From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:40 -0800 Message-ID: <167243884013.739029.9709263667215231940.stgit@magnolia> In-Reply-To: <167243883943.739029.3041109696120604285.stgit@magnolia> References: <167243883943.739029.3041109696120604285.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong If we're forcing a filesystem to be created without the metadir feature, we should forcibly disable rtgroups as well. Signed-off-by: Darrick J. Wong --- common/xfs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/xfs b/common/xfs index 0d1e0ec4bc..ccdcf45d0d 100644 --- a/common/xfs +++ b/common/xfs @@ -1821,6 +1821,10 @@ _scratch_xfs_find_metafile() # Force metadata directories off. _scratch_xfs_force_no_metadir() { + if echo "$MKFS_OPTIONS" | grep -q 'rtgroups='; then + MKFS_OPTIONS="$(echo "$MKFS_OPTIONS" | sed -e 's/rtgroups=\([01]\)/rtgroups=0/g')" + fi + if echo "$MKFS_OPTIONS" | grep -q 'metadir='; then MKFS_OPTIONS="$(echo "$MKFS_OPTIONS" | sed -e 's/metadir=\([01]\)/metadir=0/g')" return From patchwork Fri Dec 30 22:20:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085851 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 779D9C4332F for ; Sat, 31 Dec 2022 03:11:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236319AbiLaDLH (ORCPT ); Fri, 30 Dec 2022 22:11:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236311AbiLaDLG (ORCPT ); Fri, 30 Dec 2022 22:11:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65E1DB844; Fri, 30 Dec 2022 19:11:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0E296B81E69; Sat, 31 Dec 2022 03:11:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3856C433EF; Sat, 31 Dec 2022 03:11:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456261; bh=wsqC3D7LUO/WzeJWOdHsFQhiOxAWi4EJ1NZMu3PLVgo=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=rDwq5kOKSjSCIY8D3C/43a35UPdAy7HSShfhPMtnJ7jgSGWAKvq4JDNXK/f4O2rHr aBk9BmevDdiCsoY8ls4atbSJtFkaGPTT466jowQtxPW9baVJIJjwus2NdiQKpBHhd+ 4XmjdwLqViw6sUzXTd7QDcfAUvzBMoUOdMIPVmbNfkI4zrXhfc6Zyx1luCgEzvd4ig iHzjbzDRduLTK2r0wC0Gw/zOT6RxTOiKSh8y4wyMxeHp+bd1aZRw3TpFGM0v+/SGqh m6SdyQakQWn5FJzr+sI9QkX8Krr8HRJLuJ4rTKTst58YC1ZD1ZymbzsznQxr/e5thf oqRDsYJnkiyIQ== Subject: [PATCH 06/12] xfs/185: update for rtgroups From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:40 -0800 Message-ID: <167243884026.739029.5256016394301933477.stgit@magnolia> In-Reply-To: <167243883943.739029.3041109696120604285.stgit@magnolia> References: <167243883943.739029.3041109696120604285.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Send the fallocate results to seqres.full, since it doesn't matter if the call fails as long as we get the layout that we wanted. This test already has code to check the layout, so there's no point in failing on random ENOSPC errors. Signed-off-by: Darrick J. Wong --- tests/xfs/185 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/xfs/185 b/tests/xfs/185 index abeb052580..04770fd6c9 100755 --- a/tests/xfs/185 +++ b/tests/xfs/185 @@ -100,7 +100,7 @@ test "$ddbytes" -lt "$((rtbytes + (10 * rtextsize) ))" || \ # easy because fallocate for the first rt file always starts allocating at # physical offset zero. alloc_rtx="$((rtbytes / rtextsize))" -$XFS_IO_PROG -c "falloc 0 $((alloc_rtx * rtextsize))" $rtfile +$XFS_IO_PROG -c "falloc 0 $((alloc_rtx * rtextsize))" $rtfile &>> $seqres.full expected_end="$(( (alloc_rtx * rtextsize - 1) / 512 ))" From patchwork Fri Dec 30 22:20:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085852 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 7CFF5C4167B for ; Sat, 31 Dec 2022 03:11:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236307AbiLaDLT (ORCPT ); Fri, 30 Dec 2022 22:11:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231476AbiLaDLS (ORCPT ); Fri, 30 Dec 2022 22:11:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E68DFCD8; Fri, 30 Dec 2022 19:11:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D00CB61C7A; Sat, 31 Dec 2022 03:11:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 346D3C433D2; Sat, 31 Dec 2022 03:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456277; bh=9r3YWrd97eMRBfrifUnTj7hpJqxR5akt/XOxxgrKmGA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=s51b5tMk0pN8qu3k9xZdbYHnZ3KhHs6DWmpU7sx4hp/Z9kXo+C00RRVC/jtyEQbJq +aX9mpu9l2Fon6W1whPBTKwPgOpjMsoaM39hyHkhm/AaEmGiAsh+QgtNmLe71TsheE J6Hisq6jcmgD1MitrVYTizSyS5ptYblZneV8+pK/3CVsvjbv0gXk1qFEXX/58DJygE LHoqlhxhRDw89tYOlwsWoKUvTlzL8ZMrRUD25Zdp3/L0WWUB48pVVWvOcL39lAh2AK +5VPjjN2qv+QHAV9a5B0lawiydrZ9Ap/FIkmFc4jbNhYEfDEelgPfcEaaOGW+J3xhJ HXmlazPRMfCNw== Subject: [PATCH 07/12] xfs/449: update test to know about xfs_db -R From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:40 -0800 Message-ID: <167243884037.739029.16745495389634352379.stgit@magnolia> In-Reply-To: <167243883943.739029.3041109696120604285.stgit@magnolia> References: <167243883943.739029.3041109696120604285.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong The realtime groups feature added a -R flag to xfs_db so that users can pass in the realtime device. Since we've now modified the _scratch_xfs_db to use this facility, we can update the test to do exact comparisons of the xfs_db info command against the mkfs output. Signed-off-by: Darrick J. Wong --- tests/xfs/449 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/xfs/449 b/tests/xfs/449 index 5374bf2f85..66c443e994 100755 --- a/tests/xfs/449 +++ b/tests/xfs/449 @@ -32,7 +32,11 @@ echo DB >> $seqres.full cat $tmp.dbinfo >> $seqres.full # xfs_db doesn't take a rtdev argument, so it reports "realtime=external". # mkfs does, so make a quick substitution -diff -u <(cat $tmp.mkfs | sed -e 's/realtime =\/.*extsz=/realtime =external extsz=/g') $tmp.dbinfo +if $XFS_DB_PROG --help 2>&1 | grep -q -- '-R rtdev'; then + diff -u $tmp.mkfs $tmp.dbinfo +else + diff -u <(cat $tmp.mkfs | sed -e 's/realtime =\/.*extsz=/realtime =external extsz=/g') $tmp.dbinfo +fi _scratch_mount From patchwork Fri Dec 30 22:20:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085853 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 0DD1EC4167B for ; Sat, 31 Dec 2022 03:11:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236325AbiLaDLg (ORCPT ); Fri, 30 Dec 2022 22:11:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231476AbiLaDLf (ORCPT ); Fri, 30 Dec 2022 22:11:35 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9C03FCD8; Fri, 30 Dec 2022 19:11:33 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5658A61C7A; Sat, 31 Dec 2022 03:11:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9705C433EF; Sat, 31 Dec 2022 03:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456292; bh=oEf/zdfQhR48NYLAlvHHlJ9PBd0QNd/wjeiAJ8+ka5Q=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=VErj2lI+baO7B9VqF1lAbBTCcJbLnqZX2PLEna5efEr3FZKtgx15FYAiLyKzC8N+H TxJVI88Hh0oeVT8Zi33qpY1RyO1c9vvdnTm5Wff1DpKVeE4eoyu6NqxxOBphBLCEM+ tg6Rzvq8RKvnU0vYooQTxT8s+cxOruR3jvzUs/5dKSBPDDCPg3cBYkZtSaom2XzP5w aa2mu2EXQeKXmQhzpaMW/qFACzuD8Nu7LJLAPmed7GS5UKyZC9Q/UVWo7E2aHw3+Zm 3nMQ6V4dIHDizv++N1lqtDMCARsMORTb/dbzcjRqhCFH7szvtXRw590LNrWaIeFLSS HLsTGRfx1sAnw== Subject: [PATCH 08/12] xfs/122: update for rtbitmap headers From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:40 -0800 Message-ID: <167243884050.739029.15010077823493214188.stgit@magnolia> In-Reply-To: <167243883943.739029.3041109696120604285.stgit@magnolia> References: <167243883943.739029.3041109696120604285.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Signed-off-by: Darrick J. Wong --- tests/xfs/122.out | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index 01376180cc..336618cf7a 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -115,6 +115,7 @@ sizeof(struct xfs_refcount_key) = 4 sizeof(struct xfs_refcount_rec) = 12 sizeof(struct xfs_rmap_key) = 20 sizeof(struct xfs_rmap_rec) = 24 +sizeof(struct xfs_rtbuf_blkinfo) = 48 sizeof(struct xfs_rtgroup_geometry) = 128 sizeof(struct xfs_rtrmap_key) = 24 sizeof(struct xfs_rtrmap_rec) = 32 From patchwork Fri Dec 30 22:20:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085854 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 991C8C4332F for ; Sat, 31 Dec 2022 03:11:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236326AbiLaDLw (ORCPT ); Fri, 30 Dec 2022 22:11:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231476AbiLaDLv (ORCPT ); Fri, 30 Dec 2022 22:11:51 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4B49E59; Fri, 30 Dec 2022 19:11:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 89F9DB81E6B; Sat, 31 Dec 2022 03:11:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48092C433D2; Sat, 31 Dec 2022 03:11:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456308; bh=j/LDjaycDFOUuOJOHXG9wZs/COuMk+TbL0io55B4u7o=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=WLZiCGroHty9yO2wM/+VhHCxUvJh77OpMA36ekIkOL4vwnyRYz2WHClNXZS1if5TZ DRS1EdmXKjcZxD+cpuARIut+pjIVL/K0Ujma1Ly7OgZe2m5lzN4fYUrRQKkedo64a6 H1LLHoAIEs+aDqAKpbOB0WxMw0b3jralbK8c2cS+ePzhsbyxPs6k07JjTtSeldkrwS bi9JFIaX+ue5v1CsEojWdfQPUAhCZoleHYHnw7cKI4IfsPuDA//IDTcJg3Ui6GCYNu K3wdqaAegoczsXgYrUz8dGE04CwAq1s/kDUGv7RldpL6EuLjfng6p3oQwdffSqiuLL tiRNepRabcdtA== Subject: [PATCH 09/12] xfs/122: udpate test to pick up rtword/suminfo ondisk unions From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:40 -0800 Message-ID: <167243884063.739029.10787000865854510244.stgit@magnolia> In-Reply-To: <167243883943.739029.3041109696120604285.stgit@magnolia> References: <167243883943.739029.3041109696120604285.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Update this test to check that the ondisk unions for rt bitmap word and rt summary counts are always the correct size. Signed-off-by: Darrick J. Wong --- tests/xfs/122 | 2 +- tests/xfs/122.out | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/xfs/122 b/tests/xfs/122 index e616f1987d..fe6c1e36e9 100755 --- a/tests/xfs/122 +++ b/tests/xfs/122 @@ -187,7 +187,7 @@ echo 'int main(int argc, char *argv[]) {' >>$cprog # cat /usr/include/xfs/xfs*.h | indent |\ _attribute_filter |\ -grep -E '(} *xfs_.*_t|^struct xfs_[a-z0-9_]*$)' |\ +grep -E '(} *xfs_.*_t|^(union|struct) xfs_[a-z0-9_]*$)' |\ grep -E -v -f $tmp.ignore |\ sed -e 's/^.*}[[:space:]]*//g' -e 's/;.*$//g' -e 's/_t, /_t\n/g' |\ sort | uniq |\ diff --git a/tests/xfs/122.out b/tests/xfs/122.out index 336618cf7a..1379c7b3b5 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -128,6 +128,8 @@ sizeof(struct xfs_swap_extent) = 64 sizeof(struct xfs_sxd_log_format) = 16 sizeof(struct xfs_sxi_log_format) = 80 sizeof(struct xfs_unmount_log_format) = 8 +sizeof(union xfs_rtword_ondisk) = 4 +sizeof(union xfs_suminfo_ondisk) = 4 sizeof(xfs_agf_t) = 224 sizeof(xfs_agfl_t) = 36 sizeof(xfs_agi_t) = 344 From patchwork Fri Dec 30 22:20:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085855 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 7FA0DC4332F for ; Sat, 31 Dec 2022 03:12:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236328AbiLaDMJ (ORCPT ); Fri, 30 Dec 2022 22:12:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231476AbiLaDMH (ORCPT ); Fri, 30 Dec 2022 22:12:07 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B6C31104; Fri, 30 Dec 2022 19:12:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3CBA1B81E69; Sat, 31 Dec 2022 03:12:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D67FAC433EF; Sat, 31 Dec 2022 03:12:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456323; bh=pPEO/P4oIew2l6FEt8LSrmEKtt3KARoUoizygJX/xpc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=pJKauModK8Qx6phbZCsHLJpMXXv0UuvhG60TpS0E649vXCCKbcCbSLcYqCKuPYblL yXGyzN06ZteeYSYZgboRDxoiNOC59VELejeYZNi0ePihB6599z1KAE5TTiHV0py1MI SGrNbH2QnQM2WKt1RYSs+jTy739WvSZhRCdZvDEndqPZpheWVmFDLM2cOy1p3Sm7Zc bRKPezt+0BpDcBA1Tn1jRAHkEi/sFafp9nRgUt24QSI9CEFA8cYo5VhHL+rbJ9Z5TW kY6Oj8EtulpJc7xM44ifg6YnSWqDSqKWVxSTYs4t9QzJSA17puHyvbu65CW0xIrix/ f/abmo+VuX+0Q== Subject: [PATCH 10/12] xfs/27[46],xfs/556: fix tests to deal with rtgroups output in bmap/fsmap commands From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:40 -0800 Message-ID: <167243884076.739029.15949521498602375099.stgit@magnolia> In-Reply-To: <167243883943.739029.3041109696120604285.stgit@magnolia> References: <167243883943.739029.3041109696120604285.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Fix these tests to deal with the xfs_io bmap and fsmap commands printing out realtime group numbers if the feature is enabled. Signed-off-by: Darrick J. Wong --- common/xfs | 4 ++++ tests/xfs/271 | 3 ++- tests/xfs/556 | 16 ++++++++++------ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/common/xfs b/common/xfs index ccdcf45d0d..6089a05d0e 100644 --- a/common/xfs +++ b/common/xfs @@ -486,6 +486,10 @@ _xfs_has_feature() feat="rtextents" feat_regex="[1-9][0-9]*" ;; + "rtgroups") + feat="rgcount" + feat_regex="[1-9][0-9]*" + ;; esac local answer="$($XFS_INFO_PROG "$fs" 2>&1 | grep -E -w -c "$feat=$feat_regex")" diff --git a/tests/xfs/271 b/tests/xfs/271 index d67ac4d6c1..74e2c822c1 100755 --- a/tests/xfs/271 +++ b/tests/xfs/271 @@ -31,6 +31,7 @@ _scratch_mkfs > "$seqres.full" 2>&1 _scratch_mount agcount=$(_xfs_mount_agcount $SCRATCH_MNT) +rgcount=$(_xfs_mount_rgcount $SCRATCH_MNT) # mkfs lays out btree root blocks in the order bnobt, cntbt, inobt, finobt, # rmapbt, refcountbt, and then allocates AGFL blocks. Since GETFSMAP has the @@ -48,7 +49,7 @@ cat $TEST_DIR/fsmap >> $seqres.full echo "Check AG header" | tee -a $seqres.full grep 'static fs metadata[[:space:]]*[0-9]*[[:space:]]*(0\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout -_within_tolerance "AG header count" $(wc -l < $TEST_DIR/testout) $agcount 0 -v +_within_tolerance "AG header count" $(wc -l < $TEST_DIR/testout) $((agcount + rgcount)) 0 -v echo "Check freesp/rmap btrees" | tee -a $seqres.full grep 'per-AG metadata[[:space:]]*[0-9]*[[:space:]]*([0-9]*\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout diff --git a/tests/xfs/556 b/tests/xfs/556 index 66908a5410..72343e8625 100755 --- a/tests/xfs/556 +++ b/tests/xfs/556 @@ -47,16 +47,20 @@ victim=$SCRATCH_MNT/a file_blksz=$(_get_file_block_size $SCRATCH_MNT) $XFS_IO_PROG -f -c "pwrite -S 0x58 0 $((4 * file_blksz))" -c "fsync" $victim >> $seqres.full unset errordev -_xfs_is_realtime_file $victim && errordev="RT" + +awk_len_prog='{print $6}' +if _xfs_is_realtime_file $victim; then + if ! _xfs_has_feature $SCRATCH_MNT rtgroups; then + awk_len_prog='{print $4}' + fi + errordev="RT" +fi bmap_str="$($XFS_IO_PROG -c "bmap -elpv" $victim | grep "^[[:space:]]*0:")" echo "$errordev:$bmap_str" >> $seqres.full phys="$(echo "$bmap_str" | $AWK_PROG '{print $3}')" -if [ "$errordev" = "RT" ]; then - len="$(echo "$bmap_str" | $AWK_PROG '{print $4}')" -else - len="$(echo "$bmap_str" | $AWK_PROG '{print $6}')" -fi +len="$(echo "$bmap_str" | $AWK_PROG "$awk_len_prog")" + fs_blksz=$(_get_block_size $SCRATCH_MNT) echo "file_blksz:$file_blksz:fs_blksz:$fs_blksz" >> $seqres.full kernel_sectors_per_fs_block=$((fs_blksz / 512)) From patchwork Fri Dec 30 22:20:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085856 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 B5632C4332F for ; Sat, 31 Dec 2022 03:12:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236306AbiLaDMW (ORCPT ); Fri, 30 Dec 2022 22:12:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231476AbiLaDMV (ORCPT ); Fri, 30 Dec 2022 22:12:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 722681104; Fri, 30 Dec 2022 19:12:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1257761D06; Sat, 31 Dec 2022 03:12:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F1FDC433EF; Sat, 31 Dec 2022 03:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456339; bh=fYN1p6cOeDZHZJqgRz5r1WC22Pm3alzRVtB6KDDK+eo=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=uzBw7WT1axhgkpDAWQBsZt98AdvuYN6nlNHK9g+oFyZA3Ywl7spHSAiH/kuX51GEC XTnrAOyaM8rkSY/SOvaSW1Vaia/F41d+ViJ/83DLK8hjzwhkewuQkB7Hwky93Zqq3G 3FUXbW2MYAg7cgBBBO4dP+SI1fplNwiLM7JIGfJIxadtyEARwYmUbQVIIJfV+DO7Ig wp+Zg7nm1P+PESwPGo+5fXnwcf1zz8HaTKteYej9gJdtLdtP9ex4MVUw8tyE6J7KmC pL/1mZ74yd1/lNXwrH29R6mz9z7bMqIbXkYeXcHFp2Bx/ou/xhQJw9HQztqsokNmU+ U1YMimA420fMA== Subject: [PATCH 11/12] common/xfs: capture realtime devices during metadump/mdrestore From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:40 -0800 Message-ID: <167243884089.739029.13006888061367748128.stgit@magnolia> In-Reply-To: <167243883943.739029.3041109696120604285.stgit@magnolia> References: <167243883943.739029.3041109696120604285.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong If xfs_metadump supports the -x and -R switches to capture the contents of realtime devices and there is a realtime device, add the option to the command line to enable preservation. Similarly, if xfs_mdrestore supports the -R switch and there's an external scratch rtdev, pass the option so that we can restore rtdev contents. Signed-off-by: Darrick J. Wong --- common/fuzzy | 6 +++++- common/populate | 12 ++++++++++-- common/xfs | 48 +++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 54 insertions(+), 12 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index 7034ff8c42..7f96384402 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -302,7 +302,11 @@ __scratch_xfs_fuzz_mdrestore() [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ logdev=$SCRATCH_LOGDEV - _xfs_mdrestore "${POPULATE_METADUMP}" "${SCRATCH_DEV}" "${logdev}" || \ + local rtdev=none + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + rtdev=$SCRATCH_RTDEV + + _xfs_mdrestore "${POPULATE_METADUMP}" "${SCRATCH_DEV}" "${logdev}" "${rtdev}" || \ _fail "${POPULATE_METADUMP}: Could not find metadump to restore?" } diff --git a/common/populate b/common/populate index 095e771d67..c0bbbc3f3b 100644 --- a/common/populate +++ b/common/populate @@ -908,7 +908,11 @@ _scratch_populate_restore_cached() { case "${FSTYP}" in "xfs") - _xfs_mdrestore "${metadump}" "${SCRATCH_DEV}" "${logdev}" + local rtdev=none + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + rtdev=$SCRATCH_RTDEV + + _xfs_mdrestore "${metadump}" "${SCRATCH_DEV}" "${logdev}" "${rtdev}" return $? ;; "ext2"|"ext3"|"ext4") @@ -930,8 +934,12 @@ _scratch_populate_save_metadump() [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ logdev=$SCRATCH_LOGDEV + local rtdev=none + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + rtdev=$SCRATCH_RTDEV + _xfs_metadump "$metadump_file" "$SCRATCH_DEV" "$logdev" \ - compress + "$rtdev" compress res=$? ;; "ext2"|"ext3"|"ext4") diff --git a/common/xfs b/common/xfs index 6089a05d0e..a37284068f 100644 --- a/common/xfs +++ b/common/xfs @@ -679,15 +679,20 @@ _xfs_metadump() { local metadump="$1" local device="$2" local logdev="$3" - local compressopt="$4" - shift; shift; shift; shift + local rtdev="$4" + local compressopt="$5" + shift; shift; shift; shift; shift local options="$@" test -z "$options" && options="-a -o" local metadump_has_dash_x + local metadump_has_dash_R # Does metadump support capturing from external devices? $XFS_METADUMP_PROG --help 2>&1 | grep -q -- '-[a-zA-Z]*[wW]x' && \ metadump_has_dash_x=1 + # Does metadump support capturing realtime devices? + $XFS_METADUMP_PROG --help 2>&1 | grep -q -- '-R rtdev' && \ + metadump_has_dash_R=1 if [ "$logdev" != "none" ]; then options="$options -l $logdev" @@ -699,6 +704,17 @@ _xfs_metadump() { fi fi + # Capture the realtime device, if possible + if [ "$rtdev" != "none" ] && [ -n "$metadump_has_dash_R" ]; then + options="$options -R $rtdev" + + # Tell metadump to capture the rt device + if [ -n "$metadump_has_dash_x" ]; then + options="$options -x" + unset metadump_has_dash_x + fi + fi + $XFS_METADUMP_PROG $options "$device" "$metadump" res=$? [ "$compressopt" = "compress" ] && [ -n "$DUMP_COMPRESSOR" ] && @@ -710,7 +726,8 @@ _xfs_mdrestore() { local metadump="$1" local device="$2" local logdev="$3" - shift; shift; shift + local rtdev="$4" + shift; shift; shift; shift local options="$@" # If we're configured for compressed dumps and there isn't already an @@ -730,6 +747,11 @@ _xfs_mdrestore() { logdev="none" fi + # Does mdrestore support restoring to realtime devices? + if [ "$rtdev" != "none" ] && $XFS_MDRESTORE_PROG --help 2>&1 | grep -q -- '-R rtdev'; then + options="$options -R $rtdev" + fi + $XFS_MDRESTORE_PROG $options "${metadump}" "${device}" res=$? test $res -ne 0 && return $res @@ -750,12 +772,16 @@ _scratch_xfs_metadump() { local metadump=$1 shift + local logdev=none - [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ logdev=$SCRATCH_LOGDEV - _xfs_metadump "$metadump" "$SCRATCH_DEV" "$logdev" nocompress "$@" + local rtdev=none + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + rtdev=$SCRATCH_RTDEV + + _xfs_metadump "$metadump" "$SCRATCH_DEV" "$logdev" "$rtdev" nocompress "$@" } # Restore snapshotted metadata on the scratch device @@ -768,7 +794,11 @@ _scratch_xfs_mdrestore() [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ logdev=$SCRATCH_LOGDEV - _xfs_mdrestore "$metadump" "$SCRATCH_DEV" "$logdev" "$@" + local rtdev=none + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + rtdev=$SCRATCH_RTDEV + + _xfs_mdrestore "$metadump" "$SCRATCH_DEV" "$logdev" "$rtdev" "$@" } # run xfs_check and friends on a FS. @@ -895,7 +925,7 @@ _check_xfs_filesystem() if [ "$ok" -ne 1 ] && [ "$DUMP_CORRUPT_FS" = "1" ]; then local flatdev="$(basename "$device")" _xfs_metadump "$seqres.$flatdev.check.md" "$device" "$logdev" \ - compress >> $seqres.full + "$rtdev" compress >> $seqres.full fi # Optionally test the index rebuilding behavior. @@ -928,7 +958,7 @@ _check_xfs_filesystem() if [ "$rebuild_ok" -ne 1 ] && [ "$DUMP_CORRUPT_FS" = "1" ]; then local flatdev="$(basename "$device")" _xfs_metadump "$seqres.$flatdev.rebuild.md" "$device" \ - "$logdev" compress >> $seqres.full + "$logdev" "$rtdev" compress >> $seqres.full fi fi @@ -1009,7 +1039,7 @@ _check_xfs_filesystem() if [ "$orebuild_ok" -ne 1 ] && [ "$DUMP_CORRUPT_FS" = "1" ]; then local flatdev="$(basename "$device")" _xfs_metadump "$seqres.$flatdev.orebuild.md" "$device" \ - "$logdev" compress >> $seqres.full + "$logdev" "$rtdev" compress >> $seqres.full fi fi From patchwork Fri Dec 30 22:20:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085857 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 3A552C4332F for ; Sat, 31 Dec 2022 03:12:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236331AbiLaDMr (ORCPT ); Fri, 30 Dec 2022 22:12:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231476AbiLaDMo (ORCPT ); Fri, 30 Dec 2022 22:12:44 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9408E59; Fri, 30 Dec 2022 19:12:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id EE722CE19E1; Sat, 31 Dec 2022 03:12:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BB9FC433EF; Sat, 31 Dec 2022 03:12:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456355; bh=yIOVrk9FdagjHi6nbuoTErS4wGnNXWfvoJ3gGIixoqE=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=QwLMMnNQBdy5c247TaRbmPQbLh8o2VbqyRHRs7oU3hF6zAMQ25JXgU3616nd8AjwZ bi+Ha4CkWh3b0a3DpBOgYOWUfdp9BiM/G3TjIthN3dCPY8Y18h1rq4E8P+4yiA4/vN ky0MFOdgZA9T42hebNbmOECxxsyLZ45th1fczvRcEEj3U4JSklPlojh/a74XPJFj8Y Ih6b45ZLyk6KP/+Hhow4H/O/HtlJ7TuxhtuyKmObALktjTvRVoH5Ybb0srM8mRf37c s0evuTzxmaCr+UVZcev5Mx/2CKUJVHYuQrtBolDip0pOlhnJpL91D9pyMEYdCy4Jpz ZmBG5UllxQ+Hg== Subject: [PATCH 12/12] common/fuzzy: adapt the scrub stress tests to support rtgroups From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:41 -0800 Message-ID: <167243884102.739029.3905413777900442709.stgit@magnolia> In-Reply-To: <167243883943.739029.3041109696120604285.stgit@magnolia> References: <167243883943.739029.3041109696120604285.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Adapt the scrub stress testing framework to support checking realtime group metadata. Signed-off-by: Darrick J. Wong --- common/fuzzy | 27 ++++++++++++++++++++++----- common/xfs | 9 +++++++++ tests/xfs/800 | 2 +- tests/xfs/840 | 2 +- tests/xfs/841 | 2 +- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index 7f96384402..baba05de0a 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -817,8 +817,10 @@ __stress_one_scrub_loop() { local scrub_tgt="$3" local scrub_startat="$4" local start_agno="$5" - shift; shift; shift; shift; shift + local start_rgno="$6" + shift; shift; shift; shift; shift; shift local agcount="$(_xfs_mount_agcount $SCRATCH_MNT)" + local rgcount="$(_xfs_mount_rgcount $SCRATCH_MNT)" local xfs_io_args=() for arg in "$@"; do @@ -831,6 +833,12 @@ __stress_one_scrub_loop() { local ag_arg="$(echo "$arg" | sed -e "s|%agno%|$agno|g")" xfs_io_args+=('-c' "$ag_arg") done + elif echo "$arg" | grep -q -w '%rgno%'; then + # Substitute the rtgroup number + for ((rgno = start_rgno; rgno < rgcount; rgno++)); do + local rg_arg="$(echo "$arg" | sed -e "s|%rgno%|$rgno|g")" + xfs_io_args+=('-c' "$rg_arg") + done else xfs_io_args+=('-c' "$arg") fi @@ -1201,7 +1209,9 @@ _scratch_xfs_stress_scrub_cleanup() { __stress_scrub_check_commands() { local scrub_tgt="$1" local start_agno="$2" - shift; shift + local start_rgno="$3" + shift; shift; shift + local rgcount="$(_xfs_mount_rgcount $SCRATCH_MNT)" local cooked_tgt="$scrub_tgt" case "$scrub_tgt" in @@ -1231,6 +1241,10 @@ __stress_scrub_check_commands() { cooked_arg="$(echo "$cooked_arg" | sed -e 's/^repair/repair -R/g')" fi cooked_arg="$(echo "$cooked_arg" | sed -e "s/%agno%/$start_agno/g")" + if echo "$cooked_arg" | grep -q -w '%rgno%'; then + test "$rgcount" -eq 0 && continue + cooked_arg="$(echo "$cooked_arg" | sed -e "s/%rgno%/$start_rgno/g")" + fi testio=`$XFS_IO_PROG -x -c "$cooked_arg" "$cooked_tgt" 2>&1` echo $testio | grep -q "Unknown type" && \ _notrun "xfs_io scrub subcommand support is missing" @@ -1256,6 +1270,7 @@ __stress_scrub_check_commands() { # in a separate loop. If zero -i options are specified, do not run. # Callers must check each of these commands (via _require_xfs_io_command) # before calling here. +# -R For %rgno% substitution, start with this rtgroup instead of rtgroup 0. # -r Run fsstress for this amount of time, then remount the fs ro or rw. # The default is to run fsstress continuously with no remount, unless # XFS_SCRUB_STRESS_REMOUNT_PERIOD is set. @@ -1301,6 +1316,7 @@ _scratch_xfs_stress_scrub() { local remount_period="${XFS_SCRUB_STRESS_REMOUNT_PERIOD}" local stress_tgt="${XFS_SCRUB_STRESS_TARGET:-default}" local start_agno=0 + local start_rgno=0 __SCRUB_STRESS_FREEZE_PID="" __SCRUB_STRESS_REMOUNT_LOOP="" @@ -1308,12 +1324,13 @@ _scratch_xfs_stress_scrub() { touch "$runningfile" OPTIND=1 - while getopts "a:fi:r:s:S:t:w:x:X:" c; do + while getopts "a:fi:r:R:s:S:t:w:x:X:" c; do case "$c" in a) start_agno="$OPTARG";; f) freeze=yes;; i) io_args+=("$OPTARG");; r) remount_period="$OPTARG";; + R) start_rgno="$OPTARG";; s) one_scrub_args+=("$OPTARG");; S) xfs_scrub_args+=("$OPTARG");; t) scrub_tgt="$OPTARG";; @@ -1324,7 +1341,7 @@ _scratch_xfs_stress_scrub() { esac done - __stress_scrub_check_commands "$scrub_tgt" "$start_agno" \ + __stress_scrub_check_commands "$scrub_tgt" "$start_agno" "$start_rgno" \ "${one_scrub_args[@]}" if ! command -v "__stress_scrub_${exerciser}_loop" &>/dev/null; then @@ -1372,7 +1389,7 @@ _scratch_xfs_stress_scrub() { if [ "${#one_scrub_args[@]}" -gt 0 ]; then __stress_one_scrub_loop "$end" "$runningfile" "$scrub_tgt" \ - "$scrub_startat" "$start_agno" \ + "$scrub_startat" "$start_agno" "$start_rgno" \ "${one_scrub_args[@]}" & fi diff --git a/common/xfs b/common/xfs index a37284068f..f451dfb8ae 100644 --- a/common/xfs +++ b/common/xfs @@ -1524,6 +1524,15 @@ _xfs_mount_agcount() $XFS_INFO_PROG "$1" | sed -n "s/^.*agcount=\([[:digit:]]*\).*/\1/p" } +# Find rtgroup count of mounted filesystem +_xfs_mount_rgcount() +{ + local rtgroups="$($XFS_INFO_PROG "$1" | grep rgcount= | sed -e 's/^.*rgcount=\([0-9]*\).*$/\1/g')" + + test -z "$rtgroups" && rtgroups=0 + echo "$rtgroups" +} + # Wipe the superblock of each XFS AGs _try_wipe_scratch_xfs() { diff --git a/tests/xfs/800 b/tests/xfs/800 index cbcfb5f5a6..a2542be5ec 100755 --- a/tests/xfs/800 +++ b/tests/xfs/800 @@ -32,7 +32,7 @@ _require_xfs_stress_scrub _scratch_mkfs > "$seqres.full" 2>&1 _scratch_mount _require_xfs_has_feature "$SCRATCH_MNT" realtime -_scratch_xfs_stress_scrub -s "scrub rtbitmap" +_scratch_xfs_stress_scrub -s "scrub rtbitmap" -s "scrub rgbitmap %rgno%" # success, all done echo Silence is golden diff --git a/tests/xfs/840 b/tests/xfs/840 index fff41c5b8a..b9ed0a55b3 100755 --- a/tests/xfs/840 +++ b/tests/xfs/840 @@ -39,7 +39,7 @@ alloc_unit=$(_get_file_block_size $SCRATCH_MNT) scratchfile=$SCRATCH_MNT/file touch $scratchfile $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT -__stress_scrub_check_commands "$scratchfile" "" 'repair bmapbtd' +__stress_scrub_check_commands "$scratchfile" "" "" 'repair bmapbtd' # Compute the number of extent records needed to guarantee btree format, # assuming 16 bytes for each ondisk extent record diff --git a/tests/xfs/841 b/tests/xfs/841 index f743454971..5831961f5f 100755 --- a/tests/xfs/841 +++ b/tests/xfs/841 @@ -39,7 +39,7 @@ scratchfile=$SCRATCH_MNT/file mkdir $scratchdir touch $scratchfile $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT -__stress_scrub_check_commands "$scratchdir" "" 'repair directory' +__stress_scrub_check_commands "$scratchdir" "" "" 'repair directory' # Create a 2-dirblock directory total_size=$((alloc_unit * 2))