From patchwork Fri Oct 11 01:41:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831913 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A09617996; Fri, 11 Oct 2024 01:41:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610875; cv=none; b=gYHoRUCDk/MeE0ABGqbHWzjlDZqBJKBTZ4lcHtZOTgY6bs7BhGLGAfWyVot501lfWAlYBy+QUT8q/Rn89UUTlMgaI7CQ6GOKVQwbGE2raBI6kbBOMiPK2fZbVvvGVEhiqvOmVRkyXm4gYVA3sXUrdWpOSNV7pm45HqDorNnCMNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610875; c=relaxed/simple; bh=T6Fq01nqQ+Vr2QikU9vgLJPpls4sx2S2IwZMmVGGoKY=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Qer+So5y2Sd8PefbQ6Y4Ha9vvvwrkGN3tmswegMZJKYndHq6hgUdeERA9VqoHY9H4KQw+iwjUkqAPFKCiCd4ved4z2LsN7GWBmw7Bqy3PFP8gxlOc9CDcaxuHSINxVxw6XzH/C6VYU37ox4lL00O54QQLlhfX/RLPeRkuOl+gBo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ITdpdOL2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ITdpdOL2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD1DEC4CEC5; Fri, 11 Oct 2024 01:41:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610874; bh=T6Fq01nqQ+Vr2QikU9vgLJPpls4sx2S2IwZMmVGGoKY=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=ITdpdOL2Gg8EIAZkbGheeiE3imK2OUCdTR5XCTFjORlaKhTzVIiF5Oz8jPZz/MWWT VjwJMti2CA3Yybk62TY8UdBxHCXYTGSLDq7SELjoD0KxqhLkphDJAABzVEC4Md5j/S GMSe5vzXZZswsvBJJ2VupD3Qn14LHYJjOucuHLMOoTw2tV5/dP6pO6G/0rM3HsegYD ryXIxfum3cFtUP/9VO7+lCpDwc2Dbsssv5v6jtTWTQlXxSAC3OTW5gifQxoqdPTOBd EMrYhHr7pTDLsYm6NOjFoyZ8eFtAzsODnbYbb6Sany4FmL2D34heZwYDh7BTBaa25p qTU5xTgmu0Law== Date: Thu, 10 Oct 2024 18:41:14 -0700 Subject: [PATCH 01/16] common/populate: refactor caching of metadumps to a helper From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658537.4188964.6014680692584448519.stgit@frogsfrogsfrogs> In-Reply-To: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> References: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Hoist out of _scratch_populate_cached all the code that we use to save a metadump of the populated filesystem. We're going to make this more involved for XFS in the next few patches so that we can take advantage of the new support for external devices in metadump/mdrestore. Signed-off-by: Darrick J. Wong --- common/populate | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/common/populate b/common/populate index 88c8ba2b32767c..82f526dcf9e2d5 100644 --- a/common/populate +++ b/common/populate @@ -1051,6 +1051,31 @@ _scratch_populate_restore_cached() { return 1 } +# Take a metadump of the scratch filesystem and cache it for later. +_scratch_populate_save_metadump() +{ + local metadump_file="$1" + + case "${FSTYP}" in + "xfs") + local logdev=none + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + logdev=$SCRATCH_LOGDEV + + _xfs_metadump "$metadump_file" "$SCRATCH_DEV" "$logdev" \ + compress -a -o + res=$? + ;; + "ext2"|"ext3"|"ext4") + _ext4_metadump "${SCRATCH_DEV}" "${metadump_file}" compress + res=$? + ;; + *) + _fail "Don't know how to save a ${FSTYP} filesystem." + esac + return $res +} + # Populate a scratch FS from scratch or from a cached image. _scratch_populate_cached() { local meta_descr="$(_scratch_populate_cache_tag "$@")" @@ -1074,26 +1099,20 @@ _scratch_populate_cached() { # Oh well, just create one from scratch _scratch_mkfs - echo "${meta_descr}" > "${populate_metadump_descr}" case "${FSTYP}" in "xfs") _scratch_xfs_populate $@ _scratch_xfs_populate_check - - local logdev=none - [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ - logdev=$SCRATCH_LOGDEV - - _xfs_metadump "$POPULATE_METADUMP" "$SCRATCH_DEV" "$logdev" \ - compress -a -o ;; "ext2"|"ext3"|"ext4") _scratch_ext4_populate $@ _scratch_ext4_populate_check - _ext4_metadump "${SCRATCH_DEV}" "${POPULATE_METADUMP}" compress ;; *) _fail "Don't know how to populate a ${FSTYP} filesystem." ;; esac + + _scratch_populate_save_metadump "${POPULATE_METADUMP}" && \ + echo "${meta_descr}" > "${populate_metadump_descr}" } From patchwork Fri Oct 11 01:41:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831914 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8AE317C60; Fri, 11 Oct 2024 01:41:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610890; cv=none; b=TYz5b8u6b0rbY2BNALzmPhLaesEL+p7XI1d7imATXK0qOrnWAhaJRNCcgbAZdNCUVcZ2odVWIXPR7laVk8sO2sMjt4iIqCVYtyDmgQ/4F1/1TGY1wNOvcnXc4SFvmKj/4Nly7xCgVWSjuBVmbpCQZRTRRobPUbVoCPLQ+FUCz6Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610890; c=relaxed/simple; bh=zHeNgZzuCsgt2JT82tkIEUf25wDeR1pjrOeBQMkdgnk=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AHOk7uEnafMYCaLyRIRLiLWYvOiKXVPbERw3NZV0mJz9XOthFmwRUKWFoJ46BWiodEtvEBv2gfg4SEnTaQseH9voHOJ2A9HZak4nIbJIOdT1ZPKM3Yd+dfdGY3UPbnP/DE8ywUc13ees57+DfNNLOG0AjT5MtgAX2/RHq1t4u7c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qk0P79MZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qk0P79MZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96454C4CEC5; Fri, 11 Oct 2024 01:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610890; bh=zHeNgZzuCsgt2JT82tkIEUf25wDeR1pjrOeBQMkdgnk=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=qk0P79MZ9jVQUURcTRmPplImXK2xI3TtQ64uKVWsyhvrKbMNu70+Mn20tS+DOereD ck65siNQ+AXEtLtmxP6rWpEYJYScux/mcMnHL1wRhOFOxsQsZef9wzqPN1qszZvCLz 63aVqX80Fw3eisJZf71HTz/Z2orrRa5nbW9XR3X0UO84bO0sslOKURLP2AczDhgBCz 8HDULOHuWChH1Ox1/APUeDL+kjDVXNfWGYazLtAKW0LgQnI56/94zAklfJ7HGoGUT+ xB9gZAhbw1M4/BerWU0ObebqUf1rQmR8KlqVgHqkrRa1HrPgDhDGbYE0CCH8HA+NgT b9KRrscK4/5Kg== Date: Thu, 10 Oct 2024 18:41:30 -0700 Subject: [PATCH 02/16] common/{fuzzy,populate}: use _scratch_xfs_mdrestore From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658552.4188964.2373195912801336436.stgit@frogsfrogsfrogs> In-Reply-To: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> References: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Port the fuzzing and populated filesystem cache code to use this helper to pick up external log devices for the scratch filesystem. Signed-off-by: Darrick J. Wong --- common/fuzzy | 2 +- common/populate | 15 ++------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index 14d6cb104aaf57..73e5cd2a544455 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -306,7 +306,7 @@ __scratch_xfs_fuzz_unmount() __scratch_xfs_fuzz_mdrestore() { __scratch_xfs_fuzz_unmount - _xfs_mdrestore "${POPULATE_METADUMP}" "${SCRATCH_DEV}" || \ + _scratch_xfs_mdrestore "${POPULATE_METADUMP}" || \ _fail "${POPULATE_METADUMP}: Could not find metadump to restore?" } diff --git a/common/populate b/common/populate index 82f526dcf9e2d5..94ee7af9ba1c95 100644 --- a/common/populate +++ b/common/populate @@ -1017,19 +1017,8 @@ _scratch_populate_restore_cached() { case "${FSTYP}" in "xfs") - _xfs_mdrestore "${metadump}" "${SCRATCH_DEV}" - res=$? - test $res -ne 0 && return $res - - # Cached images should have been unmounted cleanly, so if - # there's an external log we need to wipe it and run repair to - # format it to match this filesystem. - if [ -n "${SCRATCH_LOGDEV}" ]; then - $WIPEFS_PROG -a "${SCRATCH_LOGDEV}" - _scratch_xfs_repair - res=$? - fi - return $res + _scratch_xfs_mdrestore "${metadump}" + return $? ;; "ext2"|"ext3"|"ext4") _ext4_mdrestore "${metadump}" "${SCRATCH_DEV}" From patchwork Fri Oct 11 01:41:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831915 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6599199B8; Fri, 11 Oct 2024 01:41:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610906; cv=none; b=ss6I8/0m/7Vw0QVN01pn5hwTGqt/dfLAs9UtTVkRHIu8w3S/ZF/28YoDRImMLlMSOhZGULdakq6odH1yHnQSu1+aRJ2vcR1Dl7Iy7z/RNC6sixG2XnW/LngeWagK5eTtazfpO+KwDBTGxFW9hAuIqLOnpfgpePCWv7BcAA6vcqI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610906; c=relaxed/simple; bh=+r4LqBto/0xMpdKNkGCuL/DXEBje+RHsp8f1N5TT1hk=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dIyy+vgO9PIx/NgJZx7cO5kJPeRsB2JBjAFAbQfmqXGXFMqnirRsYrm0W5S/MJIvQ5f/70YiowVgKwL0vRt/frktfQo/WV9SQDnRuLprNAusjPB5BezR7gJy3TbU1Rcomiz9heBkcRPSKNwOwReYyXr1/KVgXgw7kPDr7brzMl0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tg6EspGi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tg6EspGi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E35AC4CEC5; Fri, 11 Oct 2024 01:41:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610906; bh=+r4LqBto/0xMpdKNkGCuL/DXEBje+RHsp8f1N5TT1hk=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=tg6EspGiCo3M4P68GP69KutcdpDaXD3GowNEvVOmM+Q1gLFOGi8io/uK4g9SnAoka EXemyxjqHEyX3KDA1eBoip8X4+zT2Bl6m82fz1ATyzMV8mRKLOnsSXv74ATVQUF50Y wzyTDYCL/PbK7aqrgw4hQc8zqn6ouc1RddS/5VsCcDy+LRkK1pwS3ivYFo5iaS2EjG Fmy/4dNnVWvgakIGO22v6x7M2/PhrnYY58qgFNeOIP57S3++ifWyNqoZ0gIzBvz66V OorWyRpRRFOl7TyKBXSgUAKowjNr8e2+sXfOC5yq4hMTRoxMIctV6tWi65k8+mrKRx hnkJdMhBZTFLw== Date: Thu, 10 Oct 2024 18:41:45 -0700 Subject: [PATCH 03/16] fuzzy: stress data and rt sections of xfs filesystems equally From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658567.4188964.9908770902502864561.stgit@frogsfrogsfrogs> In-Reply-To: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> References: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong If we're stress-testing scrub on a realtime filesystem, make sure that we run fsstress on separate directory trees for data and realtime workouts. Signed-off-by: Darrick J. Wong --- common/fuzzy | 66 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index 73e5cd2a544455..ceb547669b51cd 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -998,13 +998,37 @@ __stress_scrub_fsx_loop() { rm -f "$runningfile" } +# Run fsstress with a timeout, and touch $tmp.killstress if dead +__run_timed_fsstress() { + timeout -s TERM "$remount_period" $FSSTRESS_PROG $* >> $seqres.full + res=$? + echo "$mode fsstress $* exits with $res at $(date)" >> $seqres.full + if [ "$res" -ne 0 ] && [ "$res" -ne 124 ]; then + # Stop if fsstress returns error. Mask off the magic code 124 + # because that is how the timeout(1) program communicates that + # we ran out of time. + touch "$tmp.killstress" + fi +} + +# Run fsstress and record outcome +__run_fsstress() { + $FSSTRESS_PROG $* >> $seqres.full + echo "fsstress $* exits with $? at $(date)" >> $seqres.full +} + # Run fsstress while we're testing online fsck. __stress_scrub_fsstress_loop() { local end="$1" local runningfile="$2" local remount_period="$3" local stress_tgt="$4" - local focus=() + local focus=(-p 4 -n 2000000) + local scale_args=() + local has_rt + + test $FSTYP = "xfs" && _xfs_has_feature "$SCRATCH_MNT" realtime && \ + has_rt=1 case "$stress_tgt" in "parent") @@ -1096,28 +1120,35 @@ __stress_scrub_fsstress_loop() { # As of March 2022, 2 million fsstress ops should be enough to keep # any filesystem busy for a couple of hours. - local args=$(_scale_fsstress_args -p 4 -d $SCRATCH_MNT -n 2000000 "${focus[@]}" $FSSTRESS_AVOID) - echo "Running $FSSTRESS_PROG $args" >> $seqres.full + local args + if [ -n "$has_rt" ]; then + mkdir -p $SCRATCH_MNT/rt $SCRATCH_MNT/data + $XFS_IO_PROG -c 'chattr +rt' $SCRATCH_MNT/rt + $XFS_IO_PROG -c 'chattr -rt' $SCRATCH_MNT/data + + rt_args=$(_scale_fsstress_args -d $SCRATCH_MNT/rt "${focus[@]}" $FSSTRESS_AVOID) + args=$(_scale_fsstress_args -d $SCRATCH_MNT/data "${focus[@]}" $FSSTRESS_AVOID) + echo "Running $FSSTRESS_PROG $args" >> $seqres.full + echo "Running $FSSTRESS_PROG $rt_args" >> $seqres.full + else + args=$(_scale_fsstress_args -d $SCRATCH_MNT "${focus[@]}" $FSSTRESS_AVOID) + echo "Running $FSSTRESS_PROG $args" >> $seqres.full + fi if [ -n "$remount_period" ]; then local mode="rw" local rw_arg="" + + rm -f "$tmp.killstress" while __stress_scrub_running "$end" "$runningfile"; do # Need to recheck running conditions if we cleared # anything. test "$mode" = "rw" && __stress_scrub_clean_scratch && continue - timeout -s TERM "$remount_period" $FSSTRESS_PROG \ - $args $rw_arg >> $seqres.full - res=$? - echo "$mode fsstress exits with $res at $(date)" >> $seqres.full - if [ "$res" -ne 0 ] && [ "$res" -ne 124 ]; then - # Stop if fsstress returns error. Mask off - # the magic code 124 because that is how the - # timeout(1) program communicates that we ran - # out of time. - break; - fi + __run_timed_fsstress $args $rw_arg & + test -n "$has_rt" && __run_timed_fsstress $rt_args $rw_arg & + wait + test -e "$tmp.killstress" && break if [ "$mode" = "rw" ]; then mode="ro" rw_arg="-R" @@ -1132,15 +1163,16 @@ __stress_scrub_fsstress_loop() { sleep 0.2 done done - rm -f "$runningfile" + rm -f "$runningfile" "$tmp.killstress" return 0 fi while __stress_scrub_running "$end" "$runningfile"; do # Need to recheck running conditions if we cleared anything __stress_scrub_clean_scratch && continue - $FSSTRESS_PROG $args >> $seqres.full - echo "fsstress exits with $? at $(date)" >> $seqres.full + __run_fsstress $args & + test -n "$has_rt" && __run_fsstress $rt_args & + wait done rm -f "$runningfile" } From patchwork Fri Oct 11 01:42:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831916 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2B2C26AC1; Fri, 11 Oct 2024 01:42:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610922; cv=none; b=tPJzwy0kUm+2IVY4SNeZ5m4Ah9G0wFFstwau2fDe1GQlBrYZbvOSMvbs9nKLEuUkGzca8DEvB64dD0NDnLFdquyWBmpS4ISsuBgf8SjDEDRq9E2Wsv5l6rBLRcqYlZJG5zmBsLNsmS0Muo/uU9Vfnuo6pZfkduSYV9k+JconNig= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610922; c=relaxed/simple; bh=JzmMVNxtm/t4f7tA6XWsqLASyLTQYHzAN2fRl6rcB68=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YdZdV4mq9eXm5/f7aH2Xw/4TB4SN0wq2uHjUSSDFskRHwEib2T3WuAsIafLzwBduXz/57EFRMTgOXHzTna8pniHu0k7HiXgesRYFe/WHMdM7RsRDSzoLPCzKNfKC8XqLqQewMItu+uiQaUQCfUkhSwkqFtvNrZ9+IMI00k1IlL8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JW+UGamL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JW+UGamL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB868C4CEC5; Fri, 11 Oct 2024 01:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610921; bh=JzmMVNxtm/t4f7tA6XWsqLASyLTQYHzAN2fRl6rcB68=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=JW+UGamLq3gubfAvY0Ftre+eLIis3hI+T/U8DPOdcSwqX9/bSaisLRsLcP7xtWo5B Z7mQvzsRCplgUvqIxEKZ8rz9jcwEH5t/+yhsB62xxt0nwuE0cD18yNLrSOw+jErLPT S4bDCc/OXZ3xlc1xf538LEfVkv5+1v+9qqkfn38e91FNS09pXdsffcewU6GDqVUxco yXqEza3LhbK/ZUaNx3KIpsIPZLxPSa3xbFQl5yr4KRO56Ky9hX48MVLk9dtRX7oj26 Bpor5E7YB9MmqaP5QzPnDQgqSDh0fsIsOlSb3HZWyZOWytPGBGTEAbfyY6qyqPBWgT Uh+Q9mCb5UWLA== Date: Thu, 10 Oct 2024 18:42:01 -0700 Subject: [PATCH 04/16] common/ext4: reformat external logs during mdrestore operations From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658582.4188964.312537719739222724.stgit@frogsfrogsfrogs> In-Reply-To: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> References: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong The e2image file format doesn't support the capture of external log devices, which means that mdrestore ought to reformat the external log to get the restored filesystem to work again. The common/populate code could already do this, so push it to the common ext4 helper. While we're at it, fix the uncareful usage of SCRATCH_LOGDEV in the populate code. Signed-off-by: Darrick J. Wong --- common/ext4 | 17 ++++++++++++++++- common/populate | 18 +++++------------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/common/ext4 b/common/ext4 index 13921bb8165a4d..e1b336d3d20cba 100644 --- a/common/ext4 +++ b/common/ext4 @@ -134,7 +134,8 @@ _ext4_mdrestore() { local metadump="$1" local device="$2" - shift; shift + local logdev="$3" + shift; shift; shift local options="$@" # If we're configured for compressed dumps and there isn't already an @@ -148,6 +149,20 @@ _ext4_mdrestore() test -r "$metadump" || return 1 $E2IMAGE_PROG $options -r "${metadump}" "${SCRATCH_DEV}" + res=$? + test $res -ne 0 && return $res + + # ext4 cannot e2image external logs, so we have to reformat the log + # device to match the restored fs + if [ "${logdev}" != "none" ]; then + local fsuuid="$($DUMPE2FS_PROG -h "${SCRATCH_DEV}" 2>/dev/null | \ + grep 'Journal UUID:' | \ + sed -e 's/Journal UUID:[[:space:]]*//g')" + $MKFS_EXT4_PROG -O journal_dev "${logdev}" \ + -F -U "${fsuuid}" + res=$? + fi + return $res } # this test requires the ext4 kernel support crc feature on scratch device diff --git a/common/populate b/common/populate index 94ee7af9ba1c95..ed3ee85ee2b6db 100644 --- a/common/populate +++ b/common/populate @@ -1021,20 +1021,12 @@ _scratch_populate_restore_cached() { return $? ;; "ext2"|"ext3"|"ext4") - _ext4_mdrestore "${metadump}" "${SCRATCH_DEV}" - ret=$? - test $ret -ne 0 && return $ret + local logdev=none + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + logdev=$SCRATCH_LOGDEV - # ext4 cannot e2image external logs, so we have to reformat - # the scratch device to match the restored fs - if [ -n "${SCRATCH_LOGDEV}" ]; then - local fsuuid="$($DUMPE2FS_PROG -h "${SCRATCH_DEV}" 2>/dev/null | \ - grep 'Journal UUID:' | \ - sed -e 's/Journal UUID:[[:space:]]*//g')" - $MKFS_EXT4_PROG -O journal_dev "${SCRATCH_LOGDEV}" \ - -F -U "${fsuuid}" - fi - return 0 + _ext4_mdrestore "${metadump}" "${SCRATCH_DEV}" "${logdev}" + return $? ;; esac return 1 From patchwork Fri Oct 11 01:42:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831917 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA5782BAF9; Fri, 11 Oct 2024 01:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610938; cv=none; b=rWdW9aIjFt8yD+L0MmHLbAs0fOitIuJI7Oww2/dZ8qcwrpXIPVqs1k7duIPE+TcR8fWODoOvEPyP6pnWVZ4ZKlTeDlJKtKQZWs2wg/7atCXaZ5hb5zvxsoklCVHGj1hNmoXXqJJd2VcEDZDOdI0WB7Jw15tlcrhv915voEce3Bg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610938; c=relaxed/simple; bh=ckwOgN2cxXvoy3HwMlPkQtdEJIRYZO0/yZzFlwGYp0E=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qSJcuDz2+XpXf30kg8kS2bbuannwkVsrAS67lCgevsbZ31nhJq2iGliEbdaET5Xb0NIMdJC4vPNl8MG+YgBrtWrPSunybYEG88jOMtbe4loReffJanZbgsBK9yGDDrR/C0wbZU/snWiYHLN+7xs0p2M2nMkoeLkFayNv7h5ZaJo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CESIHzQ+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CESIHzQ+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D4DFC4CEC5; Fri, 11 Oct 2024 01:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610937; bh=ckwOgN2cxXvoy3HwMlPkQtdEJIRYZO0/yZzFlwGYp0E=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=CESIHzQ+T2T8VdfOYl9iNM3CfT/c5YbmnF48czH/16VKkUTUFSHCPbL0ExEaKIu7G JuUjFla2BwqRykdB041Tu4SQ2MI9+i7z/inN6/2K++SvFL+grx0gUaZzSErybdZfRq pB5xfiYamKvVk+kU5hwoHtWW9LGqNWEneV5NwrO4REeiC6bGFgWI4mz3DBbNllifs+ +qhQQdu7plogjmv5JfzqwIOsQvxhlrRlf8gMmAlOWfMm2KaUiv5YVk1FTBBKKgNimB 00ukHNJb2a9IIwQRJvljosvQ7npUfSjvPP2SZ2qX1EJvVxYiWVDPqd7OkzIufX4aAN DmJAM8WSRwWJQ== Date: Thu, 10 Oct 2024 18:42:17 -0700 Subject: [PATCH 05/16] common/populate: use metadump v2 format by default for fs metadata snapshots From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658597.4188964.16216384974639853164.stgit@frogsfrogsfrogs> In-Reply-To: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> References: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong When we're snapshotting filesystem metadata after creating a populated filesystem, force the creation of metadump v2 files by default to exercise the new format, since xfs_metadump continues to use the v1 format unless told otherwise. Signed-off-by: Darrick J. Wong --- common/populate | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/common/populate b/common/populate index ed3ee85ee2b6db..b9d4b0fad5999c 100644 --- a/common/populate +++ b/common/populate @@ -55,7 +55,12 @@ __populate_fail() { case "$FSTYP" in xfs) _scratch_unmount - _scratch_xfs_metadump "$metadump" -a -o + + mdargs=('-a' '-o') + test "$(_xfs_metadump_max_version)" -gt 1 && \ + mdargs+=('-v' '2') + + _scratch_xfs_metadump "$metadump" "${mdargs[@]}" ;; ext4) _scratch_unmount @@ -1043,8 +1048,12 @@ _scratch_populate_save_metadump() [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ logdev=$SCRATCH_LOGDEV + mdargs=('-a' '-o') + test "$(_xfs_metadump_max_version)" -gt 1 && \ + mdargs+=('-v' '2') + _xfs_metadump "$metadump_file" "$SCRATCH_DEV" "$logdev" \ - compress -a -o + compress "${mdargs[@]}" res=$? ;; "ext2"|"ext3"|"ext4") From patchwork Fri Oct 11 01:42:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831918 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 455C61863F; Fri, 11 Oct 2024 01:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610953; cv=none; b=r596fhMORxsqc+x9EhUimNvhl6VTcs1sScX7Ujs9zEfMRuFaIGPVxngbTMPzGdERWKjCaGsPilfZtMYKifV2PXcFTlZlThm+eVNTOCjnKQ0DUpt6RExMPM5tqAiNH7u4KVg+Ek53mh4ldRuEehUIDmxhQQJe+hxxEm87WPrpInI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610953; c=relaxed/simple; bh=9uS+FRvC54Qbjz2xOqOvPAQvuAx82CWG+RhdjpJr3Ic=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QVAMXeQpwAr/448CMrt3Rf2DAANXLed+Kquk8jcpOKfbhQiO/7ClTIfixz7MSbDp53rxii2FDTlr0lKrs29yPCoslSSBq2iSmJQluMqSlSU8VxINhMYD9A/aUcSjEo0SO0tjx+73UtD9Z8A7JpM7bK6DtP4tiFVGYVj+WUCUOkU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=opmY0cis; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="opmY0cis" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D214C4CEC5; Fri, 11 Oct 2024 01:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610953; bh=9uS+FRvC54Qbjz2xOqOvPAQvuAx82CWG+RhdjpJr3Ic=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=opmY0cisJ20w/jruJZ2/1e3UP3V5rYb6RrKs4yI0kCazAwWIKhTrvOpGGsmczyerT 7ZZNVz9C1Dpb2j5rpGXBB5hiDjmKtW6IWAPv2C2V7oNJuWWsZeqSK12WTsEmNBUpyM g9qIYzpf0fequNInUQynDAAhhFCJv0a3/W7d+cbLYtPPSI3UvnKCgWM3OKXywap/rR fX41YklntPnrZm6ZJhJ/GBf9QjddFkzLjZdC7akyUY7YXMs9bdzwllvYkeAmPUqYaZ Miz0rjQ9qAC6mXcMCBDuH7va1n8T/QxZvL4j5vJgXIEJdTYg9XX4YfAXcyOwwJdgDm fEdbi39hkFM2g== Date: Thu, 10 Oct 2024 18:42:32 -0700 Subject: [PATCH 06/16] xfs/122: update for rtgroups From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658613.4188964.8366659246490667877.stgit@frogsfrogsfrogs> In-Reply-To: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> References: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index f47904bc75e6de..ff501d027612ee 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -45,6 +45,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_rgcount) = 272 +offsetof(xfs_sb_t, sb_rgextents) = 276 offsetof(xfs_sb_t, sb_rootino) = 56 offsetof(xfs_sb_t, sb_rrmapino) = 264 offsetof(xfs_sb_t, sb_rsumino) = 72 @@ -93,7 +96,7 @@ sizeof(struct xfs_dir3_leaf) = 64 sizeof(struct xfs_dir3_leaf_hdr) = 64 sizeof(struct xfs_disk_dquot) = 104 sizeof(struct xfs_dqblk) = 136 -sizeof(struct xfs_dsb) = 272 +sizeof(struct xfs_dsb) = 280 sizeof(struct xfs_dsymlink_hdr) = 56 sizeof(struct xfs_exchange_range) = 40 sizeof(struct xfs_extent_data) = 24 @@ -121,9 +124,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) = 56 sizeof(struct xfs_rud_log_format) = 16 sizeof(struct xfs_rui_log_format) = 16 sizeof(struct xfs_scrub_metadata) = 64 From patchwork Fri Oct 11 01:42:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831919 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D726EEAFA; Fri, 11 Oct 2024 01:42:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610968; cv=none; b=Xw1PAHYTxCTDqbDOTwbTb8WWqz9Em77x9LGP7ie/toXurn5OW+iBTzHEYJ+f5+/QTmBt16jhNLDScF+Ni5AlAn+jjZctIM85ZwOVUjHirUitbjZE8Y5ZOuRHj+eT/OGZmQdI2nuh2K/G6OCD+cb3A7SbsAmThpCTEIDY9IfFwzU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610968; c=relaxed/simple; bh=FPNpA3sOiCgpzLbSVf3sF3fqqVvCCtImr2Gi1r71jAM=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iiXnAPdNLlm+XNt8T64qSvD3x0t+eFiOABimOeC72jJW3ejvnarEYYhHMaJZxyUUqtcC7o/3qPmG9b9fNGjrgAbDWbak5HtnZ5qmIc8uafN71778nCYW89tZ3uNjrUsqlEDiktrC9RG7Q/T6fqCjd8Ll8xETYIrtneRXavCiFgA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=c6qqEJCd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="c6qqEJCd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF599C4CEC5; Fri, 11 Oct 2024 01:42:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610968; bh=FPNpA3sOiCgpzLbSVf3sF3fqqVvCCtImr2Gi1r71jAM=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=c6qqEJCd5eXpeGw+IEX1wRqyuX3vqkB4bNq87pZYSKL3crn+uFfZnyAxlul+2jSRW Gv80bkOq9dlPTjVNHQpZjao1hZh3NNUk05kLqXvI/LZr+IytthGMUqSRysZJOVKy/K 6HjgoGuyW/jjWQ5Zlws5p8FUThagPV1M9UoQz9kLC7FkSwgmf8sSX28VuH4AUS4Xb+ eF1LLUsOyBmiHSZclrGRbb8psG3x5Wf+mV4ITv8T0BWzYkoaApHS//GKui1zM1WeRD zUt+LzrhJYoVzu3hdit1z8B5C/xN6nqc2RMC3T6obJe+lkzbGggvhF7Q8IZknFPYts cN0rtdiS0yEIQ== Date: Thu, 10 Oct 2024 18:42:48 -0700 Subject: [PATCH 07/16] 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, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658628.4188964.9854560132358194265.stgit@frogsfrogsfrogs> In-Reply-To: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> References: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 18dd215197db2b..d2bb4b6a2276c9 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 510d31a4028598..f764cad73babb7 100755 --- a/tests/xfs/114 +++ b/tests/xfs/114 @@ -47,6 +47,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 b6f4c2bd093d45..1cd7076d2426ee 100755 --- a/tests/xfs/146 +++ b/tests/xfs/146 @@ -67,7 +67,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 56a9adc164eab2..1d32d702f629c9 100755 --- a/tests/xfs/187 +++ b/tests/xfs/187 @@ -130,7 +130,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_statfs_field "$SCRATCH_MNT" statfs.f_bavail) diff --git a/tests/xfs/341 b/tests/xfs/341 index 6e25549b2b3d08..9b12febf8d5c49 100755 --- a/tests/xfs/341 +++ b/tests/xfs/341 @@ -41,8 +41,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 Oct 11 01:43:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831920 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84DAE17543; Fri, 11 Oct 2024 01:43:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610984; cv=none; b=mWS/x56FFMGjpanLoTtEfsHwoDGIU6Ts5g621bpAqm1O37ThoZIsMEd6KCXH0hfkctFu4flPLTg4h3XMmGaJa5gYBlaFuNXwiS9WoInWqNyDHo6TaeJtwROXcvGCKnNfvTPFlKWPSgONTRk1YOhcHZKBjvjlppL0lwZ+9BWasMo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610984; c=relaxed/simple; bh=NQy46sA3vGvd0gOWyN742K/wahVJMO+paEvNX5y73Vo=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PEPZFJbuiNDjwsKdJ0dx5GMnoG6LH53p5IoQHGowtt3irrN8ylke3eLUU50sdI211PNua4cak6XOoAomkJe2LAo6+mwekV2qbgKpABJZqjqbl+5enDs58p94jKlmVvGbVIIltF/L/Tw7hNWx/Yzb0GiyRch2dp0KT/HHmEyyIVk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tiJO/270; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tiJO/270" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 515F7C4CEC5; Fri, 11 Oct 2024 01:43:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610984; bh=NQy46sA3vGvd0gOWyN742K/wahVJMO+paEvNX5y73Vo=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=tiJO/270I2Yo5f87ZxVsmB60C995oqw7ytKIJdui4JfrR1pbxyfwR8dpEF38fjjO7 4kXcrRx1ipALKxkxEZ+MsN+EAx2r/YnGRj84NuZEDtIR2aWEYI0/jmxpX5iO3ebg2C 4BvVLeQ4V54gONKYff66cdmhJIaCMBa6ZAvBOD4qziu+oJj04Kiu/GVqVpVD/CAbhG GQvYrVVf5v9FJrwhlsW/dnHB6wOb9AI0YjecqPSAkMRNtjIc/6EoontBfgwM+Lyt41 aqUmZAaZv3EF/ozRUV6Vq/DEb4maoyg9uC5b/C3EKeJYqDkbqkZ4KsnJTnhlGeMUMJ U+6oTyObV5QDw== Date: Thu, 10 Oct 2024 18:43:03 -0700 Subject: [PATCH 08/16] 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, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658642.4188964.1452550069283841602.stgit@frogsfrogsfrogs> In-Reply-To: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> References: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/xfs/206 b/tests/xfs/206 index ef5f4868e9bdca..01531e1f08c37e 100755 --- a/tests/xfs/206 +++ b/tests/xfs/206 @@ -65,6 +65,7 @@ mkfs_filter() -e "/exchange=/d" \ -e '/metadir=.*/d' \ -e 's/, parent=[01]//' \ + -e '/rgcount=/d' \ -e "/^Default configuration/d" } From patchwork Fri Oct 11 01:43:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831921 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BA25101E6; Fri, 11 Oct 2024 01:43:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728611000; cv=none; b=IWwwEsbJzeyr21tBjuec7zP8zJo/dK/C5HjZ2evCHOtB4aita7cSLRhMh8LVfdsV7y2MNjXw3CzPKkaOROpDsZzLSF3hjluJIh96JruGM1Ut9pRdfp2Vyh+5O8plPvpn9yuIFgz6KeNpWNN52tpDhvTbDUaxpwRZXAwhq4nWCrk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728611000; c=relaxed/simple; bh=IBphJlXMo8kIFmosi7P1qUTbVnOjzbhZ879WsQ/vNYc=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nPQClMI1VvN8lwzW3NSOz5838Zg3GE+ApUz36DQLuyY+RtCsLMonjwGFad1QhEe089JJuG17fyCZHnh6CM6K7IKbtCCsPomc+VOAWW0vnCcUH1B2QA5MkoAuITu79hWx7F2vCovVVwRGZu5LzN5PclkL6YUEXCepHPjxWXQK1iQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=p583lQRu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="p583lQRu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9B64C4CEC6; Fri, 11 Oct 2024 01:43:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728611000; bh=IBphJlXMo8kIFmosi7P1qUTbVnOjzbhZ879WsQ/vNYc=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=p583lQRurmjNbxk63wzuHjbs2JBNZ0ECQgaziBmz/KP+0nQyPp7/77yx0/WMHKLLI EI6d++/h8I9I99/qRvz16y0JazHcW1/3j5f+Es7gBrBhOVp3gClyaz0NLApLXWz6PB VFkLiQXk8MpsQP7MC8y2u1ZiZhJqV+TfM5Yrmycmy6FiNDF1QK+BiOBBo0pWM5Iv0M CkCsRGTxUvUphJNKB8RW8igwOyOQMJOst//7PPSiyP1frsnBcbvjqozNVTAoMmbo4v cDQjW/4ANfp+BMSr6KUBnWiG6VQk8Jr81ZvKaUlHTP3o8lBpbW68+k/xAyY+B5BYlS bpJRc4o5BiefQ== Date: Thu, 10 Oct 2024 18:43:19 -0700 Subject: [PATCH 09/16] 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, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658658.4188964.5581122925265318002.stgit@frogsfrogsfrogs> In-Reply-To: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> References: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/xfs b/common/xfs index 39cb04ff2cddcd..ffa5f3fa6d0d7b 100644 --- a/common/xfs +++ b/common/xfs @@ -303,6 +303,10 @@ _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' && \ + SCRATCH_OPTIONS="$SCRATCH_OPTIONS -R$SCRATCH_RTDEV" + fi echo $SCRATCH_OPTIONS $* $SCRATCH_DEV } From patchwork Fri Oct 11 01:43:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831922 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C64A5DF59; Fri, 11 Oct 2024 01:43:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728611015; cv=none; b=EYRBz1EyXs4pXHYmD1C7jJ/fAoTWlyd/P/WYjsMxqhM+/Z02vtUFzmevy7FA+wa8dOKaLS1sUDSrsuvCC+KVL88LK/xxL7J1o/MjNW6zVtiEJ+yMXq8/6Z+N7GysbeAbh1cXkjf8hjlbQmTI1y2hB4V/P2B/5jYY1rDfFDDMGSw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728611015; c=relaxed/simple; bh=KeyU9HvsbbHeoiDsxZWIcoXoZ04QPiBr7H1lH99+6dE=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KSu+fBhL40oUVaUfcnHje2RvLv8lUIErIyOObw7DzQDY1+ReE/ATwvvsZqTgjv090LKqvp9fyCDEd2gJynY9rU08IGyYnNRPvMq3jRe9it+DKEYWyLcm2gDqWwK0iFBy7gQYrzBIDyhONO/Yc33iemSqvYisJvD4cyeald+iomI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Nc1Vb1+w; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Nc1Vb1+w" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F521C4CEC5; Fri, 11 Oct 2024 01:43:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728611015; bh=KeyU9HvsbbHeoiDsxZWIcoXoZ04QPiBr7H1lH99+6dE=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=Nc1Vb1+wcKGqe1JGHKkLAXtnYDJJ+f1pr+xrNNmoeT8y4DFCSfg2gBlFq0kkOI5B0 wV5Qmujh99a7WIUPsYKsQNO34ywb5co9Zx4Lk6U0gEzrPlEKr8TqMyFXNgxs3YQvOS VT1gPoAqvEweVh+sk1No9CShbmscm6YWG2Yv+EmgspEv1ugWJKBQ3z02pK5nSbUfY3 V2RQxCMJTZNCy2FQsoZsFY1PTyqBsYLAQKsdQDzHez5LQUTXyvg87CPhqMp2aPHDz8 wbnBphtlQHmBkY9DYr5wwSL5XVjuN1vizZkVZFUfuk6Duqx3MgCmGJ525yd/dKoMZS XFVHxRSNZsJQA== Date: Thu, 10 Oct 2024 18:43:35 -0700 Subject: [PATCH 10/16] xfs/185: update for rtgroups From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658673.4188964.10504961843138111495.stgit@frogsfrogsfrogs> In-Reply-To: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> References: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong This old test is a bit too fixated on exact rt allocator behavior. With rtgroups enabled, we can end up with one large contiguous region that's split into multiple bmbt mappings to avoid crossing rtgroup boundaries. The realtime superblock throws another twist into the mix because the first rtx will always be in use, which can shift the start of the physical space mappings by up to 1 rtx. Also fix a bug where we'd try to fallocate the total number of rtx, whereas we should be asking for the number of free rtx to avoid ENOSPC errors. Signed-off-by: Darrick J. Wong --- tests/xfs/185 | 65 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/tests/xfs/185 b/tests/xfs/185 index b14bcb9b791bb8..e48b1851f524b0 100755 --- a/tests/xfs/185 +++ b/tests/xfs/185 @@ -97,10 +97,17 @@ test "$ddbytes" -lt "$((rtbytes + (10 * rtextsize) ))" || \ # higher than the size of the data device. For realtime files this is really # easy because fallocate for the first rt file always starts allocating at # physical offset zero. -alloc_rtx="$((rtbytes / rtextsize))" +rtfreebytes="$(stat -f -c '%S * %a' $rtfile | bc)" +alloc_rtx="$((rtfreebytes / rtextsize))" $XFS_IO_PROG -c "falloc 0 $((alloc_rtx * rtextsize))" $rtfile -expected_end="$(( (alloc_rtx * rtextsize - 1) / 512 ))" +# log a bunch of geometry data to the full file for debugging +echo "rtbytes $rtbytes rtfreebytes $rtfreebytes rtextsize $rtextsize" >> $seqres.full +echo "allocrtx $alloc_rtx falloc $((alloc_rtx * rtextsize))" >> $seqres.full +$XFS_IO_PROG -c statfs $SCRATCH_MNT >> $seqres.full + +total_rtx=$(_xfs_statfs_field $SCRATCH_MNT geom.rtextents) +expected_end="$(( (total_rtx * rtextsize - 1) / 512 ))" # Print extent mapping of rtfile in format: # file_offset file_end physical_offset physical_end @@ -113,13 +120,28 @@ rtfile_exts() { done } -# Make sure that we actually got the entire device. -rtfile_exts | $AWK_PROG -v end=$expected_end ' +# Make sure that fallocate actually managed to map the entire rt device. The +# realtime superblock may consume the first rtx, so we allow for that here. +# Allow for multiple contiguous mappings if the rtgroups are very small. +allowed_start=$((rtextsize / 512)) +rtfile_exts | $AWK_PROG -v exp_start=$allowed_start -v exp_end=$expected_end ' +BEGIN { + start = -1; + end = -1; +} { - if ($3 != 0) - printf("%s: unexpected physical offset %s, wanted 0\n", $0, $3); - if ($4 != end) - printf("%s: unexpected physical end %s, wanted %d\n", $0, $4, end); + if (end >= 0 && ($3 != end + 1)) + printf("%s: non-contiguous allocation should have started at %s\n", $0, end + 1); + if (start < 0 || $3 < start) + start = $3; + if (end < 0 || $4 > end) + end = $4; +} +END { + if (start > exp_start) + printf("%s: unexpected physical offset %d, wanted <= %d\n", $0, start, exp_start); + if (end != exp_end) + printf("%s: unexpected physical end %d, wanted %d\n", $0, end, exp_end); }' # Now punch out a range that is slightly larger than the size of the data @@ -132,14 +154,27 @@ expected_offset="$((punch_rtx * rtextsize / 512))" echo "rtfile should have physical extent from $expected_offset to $expected_end sectors" >> $seqres.full -# Make sure that the realtime file now has only one extent at the end of the -# realtime device -rtfile_exts | $AWK_PROG -v offset=$expected_offset -v end=$expected_end ' +# Make sure that the realtime file now maps one large extent at the end of the +# realtime device. Due to rtgroups boundary rules, there may be multiple +# contiguous mappings. +rtfile_exts | $AWK_PROG -v exp_start=$expected_offset -v exp_end=$expected_end ' +BEGIN { + start = -1; + end = -1; +} { - if ($3 != offset) - printf("%s: unexpected physical offset %s, wanted %d\n", $0, $3, offset); - if ($4 != end) - printf("%s: unexpected physical end %s, wanted %d\n", $0, $4, end); + if (end >= 0 && ($3 != end + 1)) + printf("%s: non-contiguous allocation should have started at %s\n", $0, end + 1); + if (start < 0 || $3 < start) + start = $3; + if (end < 0 || $4 > end) + end = $4; +} +END { + if (start < exp_start) + printf("%s: unexpected physical offset %d, wanted >= %d\n", $0, start, exp_start); + if (end != exp_end) + printf("%s: unexpected physical end %d, wanted %d\n", $0, end, exp_end); }' $XFS_IO_PROG -c 'bmap -elpv' $rtfile >> $seqres.full From patchwork Fri Oct 11 01:43:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831923 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F5C0DF59; Fri, 11 Oct 2024 01:43:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728611031; cv=none; b=GnBqGIbpcCNOQqhnJgNO76i/Ugd+U2JhSyNvwsf5cEHiJYnlsKjLOWQ6eHEgkojY0ypJYil4FekKGXXJ3OnZuWuBXFoCsZoAuaKUMa39VDZfNxEBT6TGPzk6IT1hcbjVYReR2A4xB89y5kSMfA7T2IX/T/X4hNCYJY0MS2HgVaE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728611031; c=relaxed/simple; bh=4/HqLGPkmsKeavT9WCdU5Pgplk8RAq8VCvFJfY+lmVs=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cWr8hzs43e4ohG+F1UIdpPX1QGW9uaz2atgU38J0De3x3SImoVMT5kyBHjdh+S7vxqV4uTiiurC7PV//PHG/iJ2+Ym6+43skzwUi484q0DIcue4joAu87KF5ordI5Q/Kytg59LxFy9EeXDLC5j9tQs2WmH/oGFRgBpKfoOqWGI8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tpHxW5W+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tpHxW5W+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FEABC4CEC5; Fri, 11 Oct 2024 01:43:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728611031; bh=4/HqLGPkmsKeavT9WCdU5Pgplk8RAq8VCvFJfY+lmVs=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=tpHxW5W+T/uJgZ8/4aSCKncrWvYswo2hKuRykKEHB6yt+dFBUoNrblrSgfk4rv0yI 3QC339hhRsz3VHFADsrOGsXSKH6LIz5hgwC24dMVt/BX2P5O0y86viUAJZBi5Ejxqw 9GW1J5Xs/T4MawGTclfq7SUG9dw6tCj4GKW5Ao47z/bw5RgN5owGrchY7juSgTQvMT uDCm9r5q9/LkOgxgCkAp0S0Fx9+haaWvlllAa5W6tjoPAFQX20ROGLK6VZA+vmzvbS 1kBtru26JT/JJOV69r7u8ysiZmIouG20XvH4qh3xvIdgucC5LSF/JXJ5mfqWps/omG 5Ahl+26pHwc0A== Date: Thu, 10 Oct 2024 18:43:50 -0700 Subject: [PATCH 11/16] 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, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658688.4188964.17314891473424728796.stgit@frogsfrogsfrogs> In-Reply-To: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> References: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 3d528e03a483fb..a739df50e319c5 100755 --- a/tests/xfs/449 +++ b/tests/xfs/449 @@ -30,7 +30,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 Oct 11 01:44:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831924 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54E30101E6; Fri, 11 Oct 2024 01:44:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728611047; cv=none; b=hPfQRofKlonZFqWvdt47ywLRTyl+0PNqBEvKxkK58tqWfSQJ3C3bg2ZbENw6Sh0HckxF4WmWjflQGWen74IV5e3ugYS00zz+MnwTcF0k2FYAeSAsDLrTFmbRyUPl7uUD2DVAfGggOVnNlY/ubLgVtAwfqfPAamQi4JuNkdL0lsw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728611047; c=relaxed/simple; bh=qYOvriPxveYS8BygKNW1NCBQL36uoNPYxVsnUN70fhk=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=erb9Q1tgr5pwkpfoA9OxgjfcA58M3XtfU8Dq3dszecmBAvM9AsdemZSAJkWnUScBZAMxrhYNEQDjCw1pWyWpoYJdHYYHi9XH9dWj60kZZOk4osFN0rCPV5l1QlAtTqoDApzOtbsEFRDEhudtLZTVI0zLUzLbFmYadFRckFuPjXQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oOUD4GW6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oOUD4GW6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9B35C4CEC5; Fri, 11 Oct 2024 01:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728611046; bh=qYOvriPxveYS8BygKNW1NCBQL36uoNPYxVsnUN70fhk=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=oOUD4GW6OEV3FbqE50dlx7Wu/BNACawaAU2F4erVlXOB1TPfGhJXd6HuIHxIjePno /pbV8cY3adRl/YsgQgHtp1xIDY4oU8+CkdkcXwR7NLBQyZ4Zx4RzZjxiUTdHsCgrFJ zlQifNKAZJ3INTuZhP0uEB/ehxRrbHD6/GUO4E4YStlqEYVf+nzc9yHODCygoLRAWs Kl03tqvnDQrNJ9o5IrTJvMrgblKrhenwQdnHL1nIJ1aeHj6YJjRq8sdXy3+4uLqgB8 MOAi7hn8XbmtFUrh2h3RrfNDZ8LIrNfh9Wq44lYK2hteQYfzkkciPEV7L8hDGYpkMJ XwWXV7B1hOu3Q== Date: Thu, 10 Oct 2024 18:44:06 -0700 Subject: [PATCH 12/16] xfs/122: update for rtbitmap headers From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658703.4188964.12482205486731778269.stgit@frogsfrogsfrogs> In-Reply-To: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> References: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 ff501d027612ee..18aff98f96ac46 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -124,6 +124,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 Oct 11 01:44:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831925 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9EB2FC12; Fri, 11 Oct 2024 01:44:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728611062; cv=none; b=Z7MTip//XfQEnjOdrEen5q2j6y2S2OvChmPplh3Cz5QqLHE3VxJ0k4N6fL2u4hfPvXDGCC4RgiPeDLKpq46HBVrtr7FzgS26GNKWmGRZvqQjilOW4cjHBLzT+m/+obzjMVxvsmrhF5LgYsErerXD4Rc84ZbmCms+xcixBhrLE7Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728611062; c=relaxed/simple; bh=pXlzLUzUMc99Pqykl+S5tJicI9TY3YC0rwB+XeUbSAU=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TE3ej+JhK0+pdi5aqWsLYwBvGIKGZmfl07QBHOHug17egQWhHIfZGELEZ/MXwA1JfKNGV83ZXVdOvrJVjEqLeMi/shBvT6qdmcUAOidNRlm1zuMraCIAzmveJTeFDuAEUgw6b/qq6hIo8ZigTPryfSYSFm9qqXl9Kz/hdprh0Ao= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bLf9Ei9H; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bLf9Ei9H" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EEA0C4CEC5; Fri, 11 Oct 2024 01:44:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728611062; bh=pXlzLUzUMc99Pqykl+S5tJicI9TY3YC0rwB+XeUbSAU=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=bLf9Ei9HJGA34uC8bPqKDA0K2rGDMPCIpMB8etMXj+IHEPDRvb86/s1CrWQVU/tmL kgn3AJBVyQdRITXMYi/0mNKo8C1y/YyygTbQoAlFeKpv95Ehez74M1Xil716RPdcGa 1Mt6cNH1HvmiZPyZBeTW2vBxwAZd4K8FSuzjbgSe2KYE/bk5JAac8qHshQ3932+lhk KVgKWLxFec52vbqoTJS/DXrtDSscqqcCh+fuodNCfQEc1ivRc5OtL6T3hErYZbwLxJ sFQcnD8qamky20GtsWX3MwEn6oRVVJDfSv9+V7rD5NV0YasDnLQNRK2ywGcq8bNn08 eOM4GZjh6pTeA== Date: Thu, 10 Oct 2024 18:44:22 -0700 Subject: [PATCH 13/16] xfs/271,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, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658719.4188964.17463502770217003820.stgit@frogsfrogsfrogs> In-Reply-To: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> References: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 | 7 +++++++ tests/xfs/271 | 4 +++- tests/xfs/556 | 16 ++++++++++------ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/common/xfs b/common/xfs index ffa5f3fa6d0d7b..f73cd467a2e7c5 100644 --- a/common/xfs +++ b/common/xfs @@ -414,6 +414,13 @@ _xfs_has_feature() feat="rtextents" feat_regex="[1-9][0-9]*" ;; + "rtgroups") + # any fs with rtgroups enabled will have a nonzero rt group + # size, even if there is no rt device (and hence zero actual + # groups) + feat="rgsize" + 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 420f4e7479220a..8a71746d6eaede 100755 --- a/tests/xfs/271 +++ b/tests/xfs/271 @@ -29,6 +29,8 @@ _scratch_mkfs > "$seqres.full" 2>&1 _scratch_mount agcount=$(_xfs_mount_agcount $SCRATCH_MNT) +agcount_wiggle=0 +_xfs_has_feature $SCRATCH_MNT rtgroups && agcount_wiggle=1 # mkfs lays out btree root blocks in the order bnobt, cntbt, inobt, finobt, # rmapbt, refcountbt, and then allocates AGFL blocks. Since GETFSMAP has the @@ -46,7 +48,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 $agcount_wiggle -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 79e03caf40a0a5..83d5022e700c8b 100755 --- a/tests/xfs/556 +++ b/tests/xfs/556 @@ -45,16 +45,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 Oct 11 01:44:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831926 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9306A184; Fri, 11 Oct 2024 01:44:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728611078; cv=none; b=V4IWw0LDkFkJd2d+4esSPoKbGMI8hn0K/4GCVsa1wjnduy2ksY8hSnz0Lb1MpAaL51J4G2HGyK24jxOxwb5DTBuJlHPxDRciDzb9qudQFNj+kN4T8dAz5uUwio07mS4MBKchvdOCfuf4pZdWHUnuqb2BlNq/riMX05i+dtJ80WA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728611078; c=relaxed/simple; bh=dxiQqe0afWVXJo5UX0M0PMZrSgcWoEdf9Pu+r/zNVAQ=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jpI3/hiMVuihirnMFAgsIeQEhTnxqfXLAQ6eE61cea5/uXSTtnVr4ujYzd2PMP46zOOUzMeHVH1RY8voCzBrXrcKy9wscspVW3e3t8S59BWcYZq6zRO/KqS0UgtHvW4qttOGrsiBEBI8l9ueqKlATyOuMOFMer459sS/Hh9C01c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=l1cmBmqD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="l1cmBmqD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D53BC4CEC5; Fri, 11 Oct 2024 01:44:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728611078; bh=dxiQqe0afWVXJo5UX0M0PMZrSgcWoEdf9Pu+r/zNVAQ=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=l1cmBmqDS7hFc6tGpsUsCx0mYiJtT5fJChNqbl+Pd+urSoYYHX50LLjuGDHlFDfIA 3Vmmxy7n8p3wbJ7igi/H1jz5ERD4f26bgZN8cr22RR7FFQ5rHODMEi9MJ4sgcgmvGi gmrQjnKELcRU5/92aaCsj0konfLoAvmlLMOE/UiBKkcomMGXDS7ofeIrF6zF0LrD+g ihrpuMgBzg+6fJTJpfnObZcAXTtH/E+mfpOs3+asqXlwBYkndX/lNxmHn8eMv8zqI0 T+R026A/SdlzcUkzF7ZujkgVWx3tmFZmCHxU1O4SDcMEn1zB39b2V6IZflEU2wTrx9 YkV/YUrhsdPxA== Date: Thu, 10 Oct 2024 18:44:37 -0700 Subject: [PATCH 14/16] 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, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658735.4188964.16562748663445704930.stgit@frogsfrogsfrogs> In-Reply-To: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> References: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong If xfs_metadump supports the -r switch 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 the dump file could restore to an external scratch rtdev, pass the -r option to mdrestore so that we can restore rtdev contents. Signed-off-by: Darrick J. Wong --- common/metadump | 21 +++++++++++++++++---- common/populate | 6 +++++- common/xfs | 48 ++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 62 insertions(+), 13 deletions(-) diff --git a/common/metadump b/common/metadump index 3373edfe92efd6..aebcb45875ddb3 100644 --- a/common/metadump +++ b/common/metadump @@ -107,6 +107,8 @@ _xfs_verify_metadump_v2() local data_loop local log_img="" local log_loop + local rt_img="" + local rt_loop # Capture metadump, which creates metadump_file _scratch_xfs_metadump $metadump_file $metadump_args $version @@ -117,8 +119,12 @@ _xfs_verify_metadump_v2() # from such a metadump file. test -n "$SCRATCH_LOGDEV" && log_img="$XFS_METADUMP_IMG.log" + # Use a temporary file to hold restored rt device contents + test -n "$SCRATCH_RTDEV" && _xfs_metadump_supports_rt && \ + rt_img="$XFS_METADUMP_IMG.rt" + # Restore metadump, which creates data_img and log_img - SCRATCH_DEV=$data_img SCRATCH_LOGDEV=$log_img \ + SCRATCH_DEV=$data_img SCRATCH_LOGDEV=$log_img SCRATCH_RTDEV=$rt_img \ _scratch_xfs_mdrestore $metadump_file # Create loopdev for data device so we can mount the fs @@ -127,15 +133,22 @@ _xfs_verify_metadump_v2() # Create loopdev for log device if we recovered anything test -s "$log_img" && log_loop=$(_create_loop_device $log_img) + # Create loopdev for rt device if we recovered anything + test -s "$rt_img" && rt_loop=$(_create_loop_device $rt_img) + # Mount fs, run an extra test, fsck, and unmount - SCRATCH_DEV=$data_loop SCRATCH_LOGDEV=$log_loop _scratch_mount + SCRATCH_DEV=$data_loop SCRATCH_LOGDEV=$log_loop SCRATCH_RTDEV=$rt_loop _scratch_mount if [ -n "$extra_test" ]; then - SCRATCH_DEV=$data_loop SCRATCH_LOGDEV=$log_loop $extra_test + SCRATCH_DEV=$data_loop SCRATCH_LOGDEV=$log_loop SCRATCH_RTDEV=$rt_loop $extra_test fi - SCRATCH_DEV=$data_loop SCRATCH_LOGDEV=$log_loop _check_xfs_scratch_fs + SCRATCH_DEV=$data_loop SCRATCH_LOGDEV=$log_loop SCRATCH_RTDEV=$rt_loop _check_xfs_scratch_fs SCRATCH_DEV=$data_loop _scratch_unmount # Tear down what we created + if [ -b "$rt_loop" ]; then + _destroy_loop_device $rt_loop + rm -f $rt_img + fi if [ -b "$log_loop" ]; then _destroy_loop_device $log_loop rm -f $log_img diff --git a/common/populate b/common/populate index b9d4b0fad5999c..a0dc48f14559bf 100644 --- a/common/populate +++ b/common/populate @@ -1048,12 +1048,16 @@ _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 + mdargs=('-a' '-o') test "$(_xfs_metadump_max_version)" -gt 1 && \ mdargs+=('-v' '2') _xfs_metadump "$metadump_file" "$SCRATCH_DEV" "$logdev" \ - compress "${mdargs[@]}" + "$rtdev" compress "${mdargs[@]}" res=$? ;; "ext2"|"ext3"|"ext4") diff --git a/common/xfs b/common/xfs index f73cd467a2e7c5..09ce830ffdefbe 100644 --- a/common/xfs +++ b/common/xfs @@ -620,14 +620,19 @@ _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="$@" if [ "$logdev" != "none" ]; then options="$options -l $logdev" fi + if [ "$rtdev" != "none" ] && _xfs_metadump_supports_rt; then + options="$options -r $rtdev" + fi + $XFS_METADUMP_PROG $options "$device" "$metadump" res=$? [ "$compressopt" = "compress" ] && [ -n "$DUMP_COMPRESSOR" ] && @@ -651,7 +656,8 @@ _xfs_mdrestore() { local metadump="$1" local device="$2" local logdev="$3" - shift; shift; shift + local rtdev="$4" + shift; shift; shift; shift local options="$@" local dumpfile_ver @@ -679,6 +685,18 @@ _xfs_mdrestore() { options="$options -l $logdev" fi + if [ "$rtdev" != "none" ] && [[ $dumpfile_ver > 1 ]] && _xfs_metadump_supports_rt; then + # metadump and mdrestore capture and restore metadata on the + # realtime volume by turning on metadump v2 format. This is + # only done if the realtime volume contains metadata such as + # rtgroup superblocks. The -r option to mdrestore wasn't added + # until the creation of rtgroups. + # + # Hence it only makes sense to specify -r here if the dump file + # itself is in v2 format. + options="$options -r $rtdev" + fi + $XFS_MDRESTORE_PROG $options "${metadump}" "${device}" } @@ -692,17 +710,27 @@ _xfs_metadump_max_version() fi } +# Do xfs_metadump/mdrestore support the -r switch for realtime devices? +_xfs_metadump_supports_rt() +{ + $XFS_METADUMP_PROG --help 2>&1 | grep -q -- '-r rtdev' +} + # Snapshot the metadata on the scratch device _scratch_xfs_metadump() { local metadump=$1 shift local logdev=none + local rtdev=none [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ logdev=$SCRATCH_LOGDEV - _xfs_metadump "$metadump" "$SCRATCH_DEV" "$logdev" nocompress "$@" + [ "$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 @@ -711,6 +739,7 @@ _scratch_xfs_mdrestore() local metadump=$1 shift local logdev=none + local rtdev=none local options="$@" # $SCRATCH_LOGDEV should have a non-zero length value only when all of @@ -721,7 +750,10 @@ _scratch_xfs_mdrestore() logdev=$SCRATCH_LOGDEV fi - _xfs_mdrestore "$metadump" "$SCRATCH_DEV" "$logdev" "$@" + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + rtdev=$SCRATCH_RTDEV + + _xfs_mdrestore "$metadump" "$SCRATCH_DEV" "$logdev" "$rtdev" "$@" } # Do not use xfs_repair (offline fsck) to rebuild the filesystem @@ -842,7 +874,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 -a -o >> $seqres.full + "$rtdev" compress -a -o >> $seqres.full fi # Optionally test the index rebuilding behavior. @@ -875,7 +907,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 -a -o >> $seqres.full + "$logdev" "$rtdev" compress -a -o >> $seqres.full fi fi @@ -959,7 +991,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 -a -o >> $seqres.full + "$logdev" "$rtdev" compress -a -o >> $seqres.full fi fi From patchwork Fri Oct 11 01:44:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831927 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12C8B6FB0; Fri, 11 Oct 2024 01:44:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728611094; cv=none; b=enMRD0UBv8PhuAexFfer9BW2nFaV2cTB0158dR8Z5VnUBLeKJNed79h3A/tJm3xvS/cVmJIxukJNl0E7iQXY9W3au3/17BUgk6TWc+5iInmZVmw3TKKxL9xKvZLBCx4GrEp3c2tjMBu1VjcN7+3MSnerSDOFJ+6916zR+rA9t7Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728611094; c=relaxed/simple; bh=dlH51RDCozgy+wEhuFiLoSXp9KwpgMcYz9vy18UOnVc=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mQyp9fGuLV0yBPBuTgfLlNJZD70Dx7VUxzAtIA1p1Q3XiT23C6cFQFpnBHPqXe053oMigWZXoU+DEW9XvihDe3KSFTik0IEb6EfGt4fP7AXm5FK0YshL3XFejSD/hwDegzUHlGSsQIFR03dUN8wxrCaP1VwjJezlyUBEXXRf/AU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SPJQl6sV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SPJQl6sV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1461C4CEC5; Fri, 11 Oct 2024 01:44:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728611093; bh=dlH51RDCozgy+wEhuFiLoSXp9KwpgMcYz9vy18UOnVc=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=SPJQl6sVBCRZnqsL8C9JYNt2aXa9qY2iOoxQ1u2u7sQuiUcRQUA62f2nRIQBDVwYl 1hX8+Dp2u5ri+91OdRJeplvBf2ONou3gcs8L8x5lORZSdeI7UAnCcFj36hwxMBzky9 KIyTjOHyIqO6/Ueta1TZN6up2K5i4DU1Nsk9UKs8AQeaFa7xHYHwOs5HQhVxtX85+U TJlR0UVELgJRLo4cznONumjPBBdd9kY+RHOzSBmM2i2AJhpA3s0o1uoo4qDfUxln3r XLSgZQRPvrFWuZSvR7HJSvMA92rX1bs/Vk9b/JnAVD9wAvJFzvmGbVALadm2KJEk93 KkU046EgXnCEA== Date: Thu, 10 Oct 2024 18:44:53 -0700 Subject: [PATCH 15/16] 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, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658749.4188964.7775010185798386769.stgit@frogsfrogsfrogs> In-Reply-To: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> References: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/581 | 2 +- tests/xfs/720 | 2 +- tests/xfs/795 | 2 +- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index ceb547669b51cd..254426be6c8cf9 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -829,8 +829,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 @@ -843,6 +845,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 @@ -1259,7 +1267,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 @@ -1289,6 +1299,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" @@ -1314,6 +1328,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. @@ -1360,6 +1375,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="" @@ -1367,12 +1383,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";; @@ -1383,7 +1400,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 @@ -1439,7 +1456,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 09ce830ffdefbe..9036fdb363904e 100644 --- a/common/xfs +++ b/common/xfs @@ -1475,6 +1475,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/581 b/tests/xfs/581 index 73b51f994a3f00..3af9ef8a19c0bb 100755 --- a/tests/xfs/581 +++ b/tests/xfs/581 @@ -30,7 +30,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/720 b/tests/xfs/720 index f928cc43d3bc54..e4af2a8d5470d2 100755 --- a/tests/xfs/720 +++ b/tests/xfs/720 @@ -37,7 +37,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/795 b/tests/xfs/795 index 5a67f02ec92eca..cd1d288add212f 100755 --- a/tests/xfs/795 +++ b/tests/xfs/795 @@ -37,7 +37,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)) From patchwork Fri Oct 11 01:45:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831928 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7476FBF6; Fri, 11 Oct 2024 01:45:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728611109; cv=none; b=Q7SKRPiLvnDSuaVGeo6LyI/I94r9NepLeadenmPGDTgi+Q0ObY0tEl4kflONvZFJS5D3ZYcAaB+d9e0rwpx5rayGSIrKKDLu1NQiMw1hfkgbwFvvk7KdUUZoPVh/lH+9GQRMWeMXouBtmWZaScmIP8RiZOkaTp/sLOAjtDOBfws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728611109; c=relaxed/simple; bh=xQg+Hp2UiOLeM2kkTZTskVi/1Vrnnwj5ZBTvCrU+WSs=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aJnaB5Vdnn2/Rus5wLkgGVi/A3HXCXBetLTM1ztR0daPaO0PJJEqwFAdsO+mtPQxBxSHDx7RqMaMvU0xkHaD+nqOfUrA8O1C8QmEefIWbmsoHzVyfJ7+KDfVc2/N/qFr9oLp5R3Ra7pcMChRQUOdTsDfkUnTrLzJ1QPtRfEx9C0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=O5PDIw1G; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="O5PDIw1G" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49984C4CEC5; Fri, 11 Oct 2024 01:45:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728611109; bh=xQg+Hp2UiOLeM2kkTZTskVi/1Vrnnwj5ZBTvCrU+WSs=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=O5PDIw1GwrvVEsfNrrwr1zD/+WP9XPqoX6LNg44bHFteWJhOpTaknMcvX0kIa4szD 92JVX+m976wU5zXwUU1EH0G1l5AL+46NVSmnAdwqbMFRngo0lGo9QSGIZt2ybtozM3 55sLf6j+8BG/CEuBaKWYDkE4eprKT8evsM/jl7V2usHGl5J5FhL4vb2N/7o8/m8E9c SwZ22T/ZtdmH+bL+9JZUtdwW3IwRiQu8szRQKqeMw+Tqmmy3IfYxBlmpjbmzu3QIQi kYpqnQetzNBZQbCIhjBVrVhiVwNebpZf8ZGCi5KuBgw5tfTCU3WOndM5VG3w2jF1z2 SR2JuGiG5D+3Q== Date: Thu, 10 Oct 2024 18:45:08 -0700 Subject: [PATCH 16/16] xfs: fix fuzz tests of rtgroups bitmap and summary files From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658765.4188964.5049650273332581384.stgit@frogsfrogsfrogs> In-Reply-To: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> References: <172860658506.4188964.2073353321745959286.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong With rtgroups, the rt bitmap and summary files are now per-group, so adjust the fuzz and fsck tests to find the new locations. Signed-off-by: Darrick J. Wong --- common/xfs | 19 +++++++++++++++++++ tests/xfs/581 | 9 ++++++++- tests/xfs/582 | 14 +++++++------- tests/xfs/739 | 6 +++++- tests/xfs/740 | 6 +++++- tests/xfs/741 | 6 +++++- tests/xfs/742 | 6 +++++- tests/xfs/743 | 6 +++++- tests/xfs/744 | 6 +++++- tests/xfs/745 | 6 +++++- tests/xfs/746 | 6 +++++- tests/xfs/793 | 14 +++++++------- 12 files changed, 81 insertions(+), 23 deletions(-) diff --git a/common/xfs b/common/xfs index 9036fdb363904e..6bd411cad67f5f 100644 --- a/common/xfs +++ b/common/xfs @@ -1932,6 +1932,25 @@ _scratch_xfs_find_metafile() local metafile="$1" local sb_field + # With metadir=1, the realtime volume is sharded into allocation + # groups. Each rtgroup has its own bitmap and summary file. Tests + # should pick a particular file, but this compatibility shim still + # exists to keep old tests working. + case "$metafile" in + "rbmino") + if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + echo "path -m /rtgroups/0.bitmap" + return 0 + fi + ;; + "rsumino") + if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + echo "path -m /rtgroups/0.summary" + return 0 + fi + ;; + esac + sb_field="$(_scratch_xfs_get_sb_field "$metafile")" if echo "$sb_field" | grep -q -w 'not found'; then return 1 diff --git a/tests/xfs/581 b/tests/xfs/581 index 3af9ef8a19c0bb..1bac2d5b6739a0 100755 --- a/tests/xfs/581 +++ b/tests/xfs/581 @@ -30,7 +30,14 @@ _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" -s "scrub rgbitmap %rgno%" + +if _xfs_has_feature "$SCRATCH_MNT" rtgroups; then + _scratch_xfs_stress_scrub -s "scrub rtbitmap %rgno%" +elif xfs_io -c 'help scrub' | grep -q rgsuper; then + _scratch_xfs_stress_scrub -s "scrub rtbitmap 0" +else + _scratch_xfs_stress_scrub -s "scrub rtbitmap" +fi # success, all done echo Silence is golden diff --git a/tests/xfs/582 b/tests/xfs/582 index f390b77f3439ee..c949e14899788a 100755 --- a/tests/xfs/582 +++ b/tests/xfs/582 @@ -31,13 +31,13 @@ _scratch_mkfs > "$seqres.full" 2>&1 _scratch_mount _require_xfs_has_feature "$SCRATCH_MNT" realtime -# XXX the realtime summary scrubber isn't currently implemented upstream. -# Don't bother trying to test it on those kernels -$XFS_IO_PROG -c 'scrub rtsummary' -c 'scrub rtsummary' "$SCRATCH_MNT" 2>&1 | \ - grep -q 'Scan was not complete' && \ - _notrun "rtsummary scrub is incomplete" - -_scratch_xfs_stress_scrub -s "scrub rtsummary" +if _xfs_has_feature "$SCRATCH_MNT" rtgroups; then + _scratch_xfs_stress_scrub -s "scrub rtsummary %rgno%" +elif xfs_io -c 'help scrub' | grep -q rgsuper; then + _scratch_xfs_stress_scrub -s "scrub rtsummary 0" +else + _scratch_xfs_stress_scrub -s "scrub rtsummary" +fi # success, all done echo Silence is golden diff --git a/tests/xfs/739 b/tests/xfs/739 index a143325e3facb6..1fcae151f007d1 100755 --- a/tests/xfs/739 +++ b/tests/xfs/739 @@ -25,7 +25,11 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -path="$(_scratch_xfs_find_metafile rbmino)" +if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + path="path -m /rtgroups/0.bitmap" +else + path="$(_scratch_xfs_find_metafile rbmino)" +fi _scratch_xfs_fuzz_metadata '' 'online' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" diff --git a/tests/xfs/740 b/tests/xfs/740 index e867d591fd99cb..74c37312b088f1 100755 --- a/tests/xfs/740 +++ b/tests/xfs/740 @@ -25,7 +25,11 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -path="$(_scratch_xfs_find_metafile rsumino)" +if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + path="path -m /rtgroups/0.summary" +else + path="$(_scratch_xfs_find_metafile rsumino)" +fi _scratch_xfs_fuzz_metadata '' 'online' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" diff --git a/tests/xfs/741 b/tests/xfs/741 index ea4aa75b24741b..95b7c5f01646b5 100755 --- a/tests/xfs/741 +++ b/tests/xfs/741 @@ -25,7 +25,11 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -path="$(_scratch_xfs_find_metafile rbmino)" +if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + path="path -m /rtgroups/0.bitmap" +else + path="$(_scratch_xfs_find_metafile rbmino)" +fi _scratch_xfs_fuzz_metadata '' 'offline' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" diff --git a/tests/xfs/742 b/tests/xfs/742 index 967e384f659f72..50dd387fae3456 100755 --- a/tests/xfs/742 +++ b/tests/xfs/742 @@ -25,7 +25,11 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -path="$(_scratch_xfs_find_metafile rsumino)" +if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + path="path -m /rtgroups/0.summary" +else + path="$(_scratch_xfs_find_metafile rsumino)" +fi _scratch_xfs_fuzz_metadata '' 'offline' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" diff --git a/tests/xfs/743 b/tests/xfs/743 index 82b87b33792cdd..c8129b76a87e33 100755 --- a/tests/xfs/743 +++ b/tests/xfs/743 @@ -26,7 +26,11 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -path="$(_scratch_xfs_find_metafile rbmino)" +if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + path="path -m /rtgroups/0.bitmap" +else + path="$(_scratch_xfs_find_metafile rbmino)" +fi _scratch_xfs_fuzz_metadata '' 'both' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" diff --git a/tests/xfs/744 b/tests/xfs/744 index 4840e78c4427ab..9382676fbb2707 100755 --- a/tests/xfs/744 +++ b/tests/xfs/744 @@ -26,7 +26,11 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -path="$(_scratch_xfs_find_metafile rsumino)" +if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + path="path -m /rtgroups/0.summary" +else + path="$(_scratch_xfs_find_metafile rsumino)" +fi _scratch_xfs_fuzz_metadata '' 'both' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" diff --git a/tests/xfs/745 b/tests/xfs/745 index 6cc3805d4c9df8..be61f4bc463a18 100755 --- a/tests/xfs/745 +++ b/tests/xfs/745 @@ -25,7 +25,11 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -path="$(_scratch_xfs_find_metafile rbmino)" +if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + path="path -m /rtgroups/0.bitmap" +else + path="$(_scratch_xfs_find_metafile rbmino)" +fi _scratch_xfs_fuzz_metadata '' 'none' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" diff --git a/tests/xfs/746 b/tests/xfs/746 index b6ec74524b0eaa..84600ab755a5aa 100755 --- a/tests/xfs/746 +++ b/tests/xfs/746 @@ -25,7 +25,11 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -path="$(_scratch_xfs_find_metafile rsumino)" +if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + path="path -m /rtgroups/0.summary" +else + path="$(_scratch_xfs_find_metafile rsumino)" +fi _scratch_xfs_fuzz_metadata '' 'none' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" diff --git a/tests/xfs/793 b/tests/xfs/793 index d942d9807967b5..59080467e90606 100755 --- a/tests/xfs/793 +++ b/tests/xfs/793 @@ -32,13 +32,13 @@ _scratch_mount _require_xfs_has_feature "$SCRATCH_MNT" realtime _xfs_force_bdev realtime $SCRATCH_MNT -# XXX the realtime summary scrubber isn't currently implemented upstream. -# Don't bother trying to fix it on those kernels -$XFS_IO_PROG -c 'scrub rtsummary' -c 'scrub rtsummary' "$SCRATCH_MNT" 2>&1 | \ - grep -q 'Scan was not complete' && \ - _notrun "rtsummary scrub is incomplete" - -_scratch_xfs_stress_online_repair -s "repair rtsummary" +if _xfs_has_feature "$SCRATCH_MNT" rtgroups; then + _scratch_xfs_stress_online_repair -s "repair rtsummary %rgno%" +elif xfs_io -c 'help scrub' | grep -q rgsuper; then + _scratch_xfs_stress_online_repair -s "repair rtsummary 0" +else + _scratch_xfs_stress_online_repair -s "repair rtsummary" +fi # success, all done echo Silence is golden