From patchwork Wed Feb 19 00:57:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981315 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 3255B1BD032; Wed, 19 Feb 2025 00:57: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=1739926674; cv=none; b=FbzXXMMSrpmZRh8W52nZ92nrFn5M7+gtI6ML2Hh0pvM0/vIWSOGqNVAEtSy0wD/+08Y7d0re0u8CSRx0Omb8Z/kDytxcoviZdiOt6IB4ZQsds5P+qJk6rEJJmOKQmdtCkGnhEtqdytT+6iRkQ+IBCTkaj4gMni5nrGgulVNlNc0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926674; c=relaxed/simple; bh=BzCPVhmCynIFvMrGyXomsqViWIdLcJ2A4v2qde3RPA8=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=brtjNwh7y/FBcIZSvO4eS2NGB96b2oJa7UqJHKtLFpYt3hZ/E2x7VzUA73hqcNcTqFT8p66fZPNW1T2F1/Qn8rn20guZ7XmeedIJeNJ8X1Do3O748lMloR+Kq5OXUA+DBHEAmEhsQESBpHjBSGgHTBIbHDUjhPsHL9eS5lVjdsA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=G40ZtAG6; 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="G40ZtAG6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 963FCC4CEE2; Wed, 19 Feb 2025 00:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926673; bh=BzCPVhmCynIFvMrGyXomsqViWIdLcJ2A4v2qde3RPA8=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=G40ZtAG6apsfhq4VEZs66jZAbWNCWilxLJLdlRlzl/tVhm26+pVeiWuA6sdcnQkzl scWPKi/oRX0DZ9qcwZ01tMgMN8mmJV01oZu7TXVVgryJ/kEQA+xzdvxWEKQg5wzftK m1BinnejX1tvZrT9EsXtwbIf4BHyVGZh46YfIOGbaX1cuh2Vb9HdFzv6gbd/bnU0RW /rtXDsi3VGjDhI30SmydEavURRWwTYBsGIt/AUQIHCxAi60eRcuPR8w5S/ASPqJ0WO p6+iV+igU6JAeIunC2FcZxBO8PFyQykl7nwT0ZKqQiH9B+7hiemGuis8rdnnAxLzk/ Pb+vEIaHEWfsQ== Date: Tue, 18 Feb 2025 16:57:53 -0800 Subject: [PATCH 01/15] common/populate: refactor caching of metadumps to a helper From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992589198.4079457.6813508569185087856.stgit@frogsfrogsfrogs> In-Reply-To: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> References: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- common/populate | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/common/populate b/common/populate index 7690f269df8e79..627e8ca49694e7 100644 --- a/common/populate +++ b/common/populate @@ -1064,6 +1064,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 "$@")" @@ -1087,26 +1112,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 Wed Feb 19 00:58:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981316 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 AE5FC3596B; Wed, 19 Feb 2025 00:58: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=1739926689; cv=none; b=pEq6kSGPdj3TFGdJ1MA72rm/FNqTdTpmO9RNCZRff+zdkHLBIPnImV3g7a0CXxBrZSDFE1qTTuMOGtjwhOzTJo/GWkFEk9ZZ4qzamJziAvRX19bL2P+fUJaIfRHydr1y0x2TUdvnjf3UzrSEP5JyC2eDOC5Nf1xpMPXWsgCQAzo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926689; c=relaxed/simple; bh=o3VUUXGYQa5mzmJ/im4aC1NvxgbM8eoTLmzt9FY8a38=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Xg7oC8oSh0aKoGFOFvqQcEVjKUsm21ntNnMb0OxxT8K3mO5K5/Ke6+eexXb2olHObDgntP1egKYTgj2kJiZsw6A58y8+ltXeoj6pJB9sIAMlFfnpsjT2WO5M2e/r9w9XckVUA4HbKZbUNRucIX3JyBJKtRguMXjyh2z1Tdb4adA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XF6pBq7d; 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="XF6pBq7d" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 372F3C4CEE2; Wed, 19 Feb 2025 00:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926689; bh=o3VUUXGYQa5mzmJ/im4aC1NvxgbM8eoTLmzt9FY8a38=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=XF6pBq7dtibGN8YyGqU80fquTczU4Rti0ziD2r9d9wdLzO3hxka7EWN+iOWdaLmiY WcvirqgoC2Bn8f2zxPBUoSSB1sxnQWXHmTk5sY1KT6GDGaYP88oW6OM/tsa7aIWAr7 oLUZf7T0/H3Ii4L8y18Mp8EPm60jbAo2FnOUIUVlCNbYz12bFR3JhhsRoyn89mYdF0 x5cIv0vZZlOBKhs+4g/m4bvMt+ir5RBomXN4KZUPmBdLGEBuPIRXtltH5Qr8JN9ac2 SYqi2hgZkNL9MvPym6eveFWzdgTxgrtD8A5gxiNfoGpYVFoORXzkUlA1bMgefLk7+T s0w2GP4/SIpOA== Date: Tue, 18 Feb 2025 16:58:08 -0800 Subject: [PATCH 02/15] common/{fuzzy,populate}: use _scratch_xfs_mdrestore From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992589216.4079457.5690934779911954776.stgit@frogsfrogsfrogs> In-Reply-To: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> References: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- common/fuzzy | 2 +- common/populate | 15 ++------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index 702ebc4b9aed84..ee9fe75609e603 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 627e8ca49694e7..e6804cbc6114ba 100644 --- a/common/populate +++ b/common/populate @@ -1030,19 +1030,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 Wed Feb 19 00:58:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981317 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 6F183DDD3; Wed, 19 Feb 2025 00:58:25 +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=1739926705; cv=none; b=nMv9SVvNk7yQaT7gXXNcJQt4KM6jwEfBH5vou4Ri5v1qv59muUOfwndrWHijsVtgo9KZ4VdR5DaWiV0XAInVNxNrOgG28x6/yAXK7lqx7rLGMFOhOAMhvij45bIZUwwyg54o5X+XBZ3tm3xXzCCygUIdYEJsd5YEKKhgeqtJLG4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926705; c=relaxed/simple; bh=yw01JJVhph53oetXG5itZyW4BHx7L0yOGTwNLg7grRQ=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j7ereotZjgzSTaOE//FwDHndidsDH/yCSL60znI8DQxeUg3dZ/kfYWeNRlaUenAIEQyBKmModvooX4LWbI/JVChhfX0ktpYTwyPl4rP1cQ9tJx2nxuOoPRnnD4f0ra12XhrDA9oTMSJcn8zJc7JqS9MpDvRxah0UiX9ZL/LjNYc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=q9VkWzQt; 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="q9VkWzQt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D59D8C4CEE2; Wed, 19 Feb 2025 00:58:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926704; bh=yw01JJVhph53oetXG5itZyW4BHx7L0yOGTwNLg7grRQ=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=q9VkWzQtnE0fMKCGb+VQ7UpRigRV3dsyMifCFP+Xcnro706fJxxyViOX0kbZs8KnL 9gG0k3iuH3agcgvgbWTaKoE9O8NzOxFo4if7mUhIA6jIcKCWdI5Rc3bKxilcBD5NkM K+tbuenARg+7Pkj7xvi+hnF8YdHQbLxPFGtGxWiiZapMCeuygkP5Yzi0j/BUaIPjHH 8l1C5gmM/6tVTYzF/BtoqThrW/TeLUyGyFBsWeg05xDPKbh+/DHeJtFDhQU+oumpLl JtCbrFwhUPFQ0azYxthoqPl/7/hl5J+JYfdf7OkiK9Mkio/tOwjGB/Ixm1j5GK1qPg MUS7bY4+KEunQ== Date: Tue, 18 Feb 2025 16:58:24 -0800 Subject: [PATCH 03/15] fuzzy: stress data and rt sections of xfs filesystems equally From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992589235.4079457.2842406217553234453.stgit@frogsfrogsfrogs> In-Reply-To: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> References: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- common/fuzzy | 56 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index ee9fe75609e603..39efdb22c71627 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -1015,15 +1015,28 @@ __stress_scrub_fsx_loop() { rm -f "$runningfile" } +# Run fsstress and record outcome +___scrub_run_fsstress() { + _run_fsstress "$@" + local res=$? + echo "fsstress $* exits with $res at $(date)" >> $seqres.full + test "$res" -ne 0 && touch "$tmp.killstress" +} + # 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 res + local focus=(-p 4) + local res res2 local duration + local has_rt + local d_args r_args + + test $FSTYP = "xfs" && _xfs_has_feature "$SCRATCH_MNT" realtime && \ + has_rt=1 case "$stress_tgt" in "parent") @@ -1113,9 +1126,24 @@ __stress_scrub_fsstress_loop() { ;; esac - local args=$(_scale_fsstress_args -p 4 -d $SCRATCH_MNT "${focus[@]}") - echo "Running $FSSTRESS_PROG $args" >> $seqres.full + if [ -n "$has_rt" ]; then + local rdir="$SCRATCH_MNT/rt" + local ddir="$SCRATCH_MNT/data" + mkdir -p "$rdir" "$ddir" + $XFS_IO_PROG -c 'chattr +rt' "$rdir" + $XFS_IO_PROG -c 'chattr -rt' "$ddir" + + r_args=$(_scale_fsstress_args -d "$rdir" "${focus[@]}") + d_args=$(_scale_fsstress_args -d "$ddir" "${focus[@]}") + echo "Running $FSSTRESS_PROG $d_args" >> $seqres.full + echo "Running $FSSTRESS_PROG $r_args" >> $seqres.full + else + d_args=$(_scale_fsstress_args -d $SCRATCH_MNT "${focus[@]}") + echo "Running $FSSTRESS_PROG $d_args" >> $seqres.full + fi + + rm -f "$tmp.killstress" if [ -n "$remount_period" ]; then local mode="rw" local rw_arg="" @@ -1125,10 +1153,10 @@ __stress_scrub_fsstress_loop() { test "$mode" = "rw" && __stress_scrub_clean_scratch && continue duration=$(___stress_scrub_duration "$end" "$remount_period") - _run_fsstress $duration $args $rw_arg >> $seqres.full - res=$? - echo "$mode fsstress exits with $res at $(date)" >> $seqres.full - [ "$res" -ne 0 ] && break; + ___scrub_run_fsstress $duration $d_args $rw_arg & + test -n "$has_rt" && ___scrub_run_fsstress $duration $r_args $rw_arg & + wait + test -e "$tmp.killstress" && break if [ "$mode" = "rw" ]; then mode="ro" @@ -1144,7 +1172,7 @@ __stress_scrub_fsstress_loop() { sleep 0.2 done done - rm -f "$runningfile" + rm -f "$runningfile" "$tmp.killstress" return 0 fi @@ -1152,12 +1180,12 @@ __stress_scrub_fsstress_loop() { # Need to recheck running conditions if we cleared anything __stress_scrub_clean_scratch && continue duration=$(___stress_scrub_duration "$end" "$remount_period") - _run_fsstress $duration $args >> $seqres.full - res=$? - echo "$mode fsstress exits with $res at $(date)" >> $seqres.full - [ "$res" -ne 0 ] && break; + ___scrub_run_fsstress $duration $d_args & + test -n "$has_rt" && ___scrub_run_fsstress $duration $r_args & + wait + test -e "$tmp.killstress" && break done - rm -f "$runningfile" + rm -f "$runningfile" "$tmp.killstress" } # Make sure we have everything we need to run stress and scrub From patchwork Wed Feb 19 00:58:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981318 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 12A5C3F9D5; Wed, 19 Feb 2025 00:58:40 +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=1739926721; cv=none; b=npHFW3AofPbimMXyrgk4p6UjXrD4iP/vLV5X3pStolom0V6ACYAqCS4pXbzfqBnWQgAboAAs0W3k0vLwlI3o73YbiulO1Nj8NA26wjefJ2ZYSiBdIyWR4P/kpjIWZA3G4GpFxH77gacVTG6v6UrqwbmrQfyRpbF2ZB/Bq9CLFP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926721; c=relaxed/simple; bh=56Iuf6Y4DdIz5SsfapY9i66r/jNm7mXYmbj5M+hTGrc=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=imNwsj0DL4X2H6Y3qgyX6uV5dSWCFZv4JpQZ1LGxqfIGry6dQ9MVaPfP6wc3pdrp33/hbBYmDip2PbsOieeB5m0jFDSdt6T2zqbh5W9q7aNM2uVE9w69mUREnRhAPc2kxlCp4Piv0YQqrrhEfVmJOVKduEbe3xdkqJlJf3jXBaQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IovLG2Ds; 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="IovLG2Ds" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76A86C4CEE2; Wed, 19 Feb 2025 00:58:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926720; bh=56Iuf6Y4DdIz5SsfapY9i66r/jNm7mXYmbj5M+hTGrc=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=IovLG2DsXgO688vA2/3wvkvdcGWqbx5oMBXEmmXOKd34kl/xeArsD4hcRUwTsHMpn F51lFFArsw2LPTnKp+TvaIJqgVu7+bkxQhqba2IE4BsouFzhIGKAzsulUVGS05WPHI BEO2y/sYRUlyMovcXKurPhGww3FsYiIldoswTg379qAYAnr0AUHtQYsZpGWeUGs4b8 RBoN1rzqhr4UhHESO8lnGmTZZzptWRPUV0nux5Ky7vJ5Bd1LJ+cNPVcaf3AfZLbxbJ iPgYlF6EnKBVsW+i/j4j3ql36akASfnXP0TBiRN578b5IBQFxGr5j3dQaWjDfW6TN4 4s/t49nPXQulg== Date: Tue, 18 Feb 2025 16:58:40 -0800 Subject: [PATCH 04/15] fuzzy: run fsx on data and rt sections of xfs filesystems equally From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992589254.4079457.10498287265932477514.stgit@frogsfrogsfrogs> In-Reply-To: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> References: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> 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 fsx on separate files for data and realtime workouts. Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- common/fuzzy | 53 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index 39efdb22c71627..1548f372fac58a 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -955,6 +955,14 @@ ___stress_scrub_duration() echo "--duration=$delta" } +# Run fsx and record outcome +___scrub_run_fsx() { + $FSX_PROG "$@" >> $seqres.full + local res=$? + echo "fsx $* exits with $res at $(date)" >> $seqres.full + test "$res" -ne 0 && touch "$tmp.killfsx" +} + # Run fsx while we're testing online fsck. __stress_scrub_fsx_loop() { local end="$1" @@ -963,14 +971,33 @@ __stress_scrub_fsx_loop() { local stress_tgt="$4" # ignored local focus=(-q -X) # quiet, validate file contents local duration - local res + local has_rt + local d_args r_args + + test $FSTYP = "xfs" && _xfs_has_feature "$SCRATCH_MNT" realtime && \ + has_rt=1 focus+=(-o $((128000 * LOAD_FACTOR)) ) focus+=(-l $((600000 * LOAD_FACTOR)) ) - local args="$FSX_AVOID ${focus[@]} ${SCRATCH_MNT}/fsx.$seq" - echo "Running $FSX_PROG $args" >> $seqres.full + if [ -n "$has_rt" ]; then + local rdir="$SCRATCH_MNT/rt" + local ddir="$SCRATCH_MNT/data" + mkdir -p "$rdir" "$ddir" + $XFS_IO_PROG -c 'chattr +rt' "$rdir" + $XFS_IO_PROG -c 'chattr -rt' "$ddir" + + r_args="$FSX_AVOID ${focus[*]} $rdir/fsx" + d_args="$FSX_AVOID ${focus[*]} $ddir/fsx" + echo "Running $FSX_PROG $d_args" >> $seqres.full + echo "Running $FSX_PROG $r_args" >> $seqres.full + else + d_args="$FSX_AVOID ${focus[*]} $SCRATCH_MNT/fsx" + echo "Running $FSX_PROG $d_args" >> $seqres.full + fi + + rm -f "$tmp.killfsx" if [ -n "$remount_period" ]; then local mode="rw" local rw_arg="" @@ -980,10 +1007,10 @@ __stress_scrub_fsx_loop() { test "$mode" = "rw" && __stress_scrub_clean_scratch && continue duration=$(___stress_scrub_duration "$end" "$remount_period") - $FSX_PROG $duration $args $rw_arg >> $seqres.full - res=$? - echo "$mode fsx exits with $res at $(date)" >> $seqres.full - test "$res" -ne 0 && break + ___scrub_run_fsx $duration $d_args $rw_arg & + test -n "$has_rt" && ___scrub_run_fsx $duration $r_args $rw_arg & + wait + test -e "$tmp.killfsx" && break if [ "$mode" = "rw" ]; then mode="ro" @@ -999,7 +1026,7 @@ __stress_scrub_fsx_loop() { sleep 0.2 done done - rm -f "$runningfile" + rm -f "$runningfile" "$tmp.killfsx" return 0 fi @@ -1007,12 +1034,12 @@ __stress_scrub_fsx_loop() { # Need to recheck running conditions if we cleared anything __stress_scrub_clean_scratch && continue duration=$(___stress_scrub_duration "$end" "$remount_period") - $FSX_PROG $duration $args >> $seqres.full - res=$? - echo "fsx exits with $res at $(date)" >> $seqres.full - test "$res" -ne 0 && break + ___scrub_run_fsx $duration $d_args & + test -n "$has_rt" && ___scrub_run_fsx $duration $r_args & + wait + test -e "$tmp.killfsx" && break done - rm -f "$runningfile" + rm -f "$runningfile" "$tmp.killfsx" } # Run fsstress and record outcome From patchwork Wed Feb 19 00:58:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981319 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 444B881724; Wed, 19 Feb 2025 00:58:56 +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=1739926736; cv=none; b=ZRfOVcyVq0h4TsnaexgTLM2qCqCH+Toq5eHs1By9WycE4z+qda+53Kh4eprRxRmQnKFXMrVvk4R2zZnZROLpqRj1/odfzeb+JTfTVibEtZ2QSvKapka1oADxb9ThIoloUgD32jN92PQSrxeK8kE/Sl0tNpD2+oQ+0ky9fAfjkoE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926736; c=relaxed/simple; bh=ofR2nfAv6ZdrOoUdpGDrZifQWcILDaZXQ3B7wGvAI/k=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Nw9VSP80TJr+6kATusXhvZrarxJirSXyyt57IZ4H8wGiaj64wiyc2pKIdvlygNmy7IncapLiSLCrb3doXcNgixGFMbZTlYCVA0U8xd415V3Wwgnu0rpGM/WAO8pQeJwjOcK1JWnW0kHSRN5y+pIXTIozHQclKsOtu+BlUL/pM6I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e+ZbsAKi; 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="e+ZbsAKi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1572AC4CEE2; Wed, 19 Feb 2025 00:58:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926736; bh=ofR2nfAv6ZdrOoUdpGDrZifQWcILDaZXQ3B7wGvAI/k=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=e+ZbsAKi3bU3Juewi29FkhRAEJZSb6SfBkWBZ6HSOl/ALC95v9s7dHDt4vLTV2U+k O6b6v6XE8+Ak0by/f0PWMUIHlIBKP4To5VmnMLziP2sXMVF1zLWOLfd1o1VlNVGgRi OpeO8XRL85tjxshbrFVb/StQ4SujsaFZdmLl/fXBMo7jbJZKcx8JXDCQMitbmOr8D+ 6PawGWG3i+MeP8WgZIP8HPa+Bd0KjaQgFa7KrcMQjvUz9+kxwP7Y6kmk5TjCCfTcSR 1ZX+9gwRLP4hQKd7+J5rSns0EzeFyl1krQX2XXzTbAJA6vAhGEfE7fqQIpYTsI1r4p V866YEksmSzGQ== Date: Tue, 18 Feb 2025 16:58:55 -0800 Subject: [PATCH 05/15] common/ext4: reformat external logs during mdrestore operations From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992589272.4079457.17538661785920086668.stgit@frogsfrogsfrogs> In-Reply-To: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> References: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- 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 e6804cbc6114ba..32dc5275e2debd 100644 --- a/common/populate +++ b/common/populate @@ -1034,20 +1034,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 Wed Feb 19 00:59:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981320 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 3818485C5E; Wed, 19 Feb 2025 00:59:11 +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=1739926752; cv=none; b=UD2zPF24CdzUnDxpHo4+xNKVtLW+BmmRCM8S7XzywQJfIum232u0HnUiTE7NcCXQUzj6BeOScKJL+mMK95wwjqhFTUYRyHV+C5RzvR8+LIuLsdH9/NL7lg5huKYvLYTlzhPlRRSk0wssujS/1dZtvqBybsdzE8SIWIGzU5npk2A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926752; c=relaxed/simple; bh=znBTG2CrkipuWwoJUrB+iX0KUhqPI741QQj79rwL078=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ukZituuiqrWM+e7qwSPbrLo+euXc/BSt2I0pDavCAQrVDXXB1wvOHMQwCCTpm1Z+u/OcIuuhDWNfQXWrOuZvK2hxQ3USHILDktOjoFYz4C1uQDsB8N6kVSnAYk3bHPd/BP6kyd4vjBEbLOw8dnOhoDBVv6YO5ZrZltFk2ogB0Is= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k0s4ZtEX; 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="k0s4ZtEX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5EF0C4CEE2; Wed, 19 Feb 2025 00:59:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926751; bh=znBTG2CrkipuWwoJUrB+iX0KUhqPI741QQj79rwL078=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=k0s4ZtEXtvVoX4yz8B39dd0wCeuL7Zxbi4Zo6mqAoVKwNmzn32qz7DRSAzoC97ReB HWYheA2ew/LP2WjSXJCOqi8smTy5v0rUY0RHXGGSgijr4c5NZikIMVM8mLwrUM+LRw 0ZbsfNK/V5V8Z/mtaXFuNe0VMeNY4pT3ajDpW68IA70iRSC6Lk13eYoosQCxgA+bcq +QhUm9FoRA1EqW7/CFjHhVSCpkaYScANwhDPAk0oqeFX+OWsLiHHSJjV4iFt14k7dI S7IzJC/PicFOpSjADchCLGf5YTfsYDwtU8Ic/1NZBnpJxIXziT6EYfNkPW9esD4VYs +Mc4E3SZJ7AAQ== Date: Tue, 18 Feb 2025 16:59:11 -0800 Subject: [PATCH 06/15] common/populate: use metadump v2 format by default for fs metadata snapshots From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992589290.4079457.11127255945217928255.stgit@frogsfrogsfrogs> In-Reply-To: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> References: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- common/populate | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/common/populate b/common/populate index 32dc5275e2debd..9fc1ee32bd490d 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 @@ -1056,8 +1061,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 Wed Feb 19 00:59:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981321 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 E2B4713CFB6; Wed, 19 Feb 2025 00:59:27 +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=1739926768; cv=none; b=JAsCCWunDtGe+w2G/dl+DZ403tZEMk2VVrmCn7LLKK2v4opjCEpVRULdSg2AeEoutyphu9Cu3cBdcQxBNKbHz+ohq0Ok/w7kRm/ZYBYUxPle2VJidjlUn6TYsM7+LT7L7RRZ6F61Nirs9JnADQQVbeaDmMor1kFJFz0ZNoyuzQU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926768; c=relaxed/simple; bh=w9l5oe9KrYAocr3lXFRNF6FqOuQwVPQ9y4X2JWHYETc=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MxikS4+3tX+b7nPjhS7o2NYvHsHYBz8NF8DuqWc4KROWEgyUkqq4k9Ag0H7sH3bT0pdCyt0YXkbIva6DEXG+bFRhOsOtpzfG5VyozPKE/E+mJr2OgXVfqIMCgJd58SGZvIAVpoW86SWZ32K4/zBvzdOox51H0qhN73XwbLI17aI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cjcWFxcg; 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="cjcWFxcg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52FA4C4CEE2; Wed, 19 Feb 2025 00:59:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926767; bh=w9l5oe9KrYAocr3lXFRNF6FqOuQwVPQ9y4X2JWHYETc=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=cjcWFxcg7OsH0wg/bo64gh32xiTTn2fHWhVsnnchzJFSQNPZrHFQ2TnvRd7xWcFsC MpR/7NoQDgsbYfn5CuPQiRLnFS7tKPQH3xu+Zi065RHTbD+4gpOLE9g8HXVTy++9dg rHspyVpuvEoi64ToaErzE3Ts+rlWPXWk0jCCELqxFpeNgZHfpvtKfKuCWP8ZyiZTTv B/MUU8qo8QsYZr5WLD/QNLk4u7haPaLP/weDAOgaUWLGoFEmNXQMlgMvijgjxZmAlC T241BKydUGlpSxMI+iLwgLlNv2UdSU76vhO1MvuxzcekQjywV5geozZ3Nw1qy5z2Mq pEtz0UKrIQAcg== Date: Tue, 18 Feb 2025 16:59:26 -0800 Subject: [PATCH 07/15] punch-alternating: detect xfs realtime files with large allocation units From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992589308.4079457.15370995926162762676.stgit@frogsfrogsfrogs> In-Reply-To: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> References: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- 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 Wed Feb 19 00:59:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981322 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 7187876025; Wed, 19 Feb 2025 00:59:43 +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=1739926783; cv=none; b=RNFqknPtP18Lyf+L7D4kXDh5Y3vMsO+X+KDcf5ofAo+P7FcioQHsu2unpcMjwJlEffmc4a/fF0GIv4fxbDtlo4ARiaw4IQaewHif/8GVtdBfjaKDThOytHH0voBlXPz7GLVjY+sZeHtOMxILHkKjnr9HjEvhJQUCYDisDhXWE/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926783; c=relaxed/simple; bh=duWzI1uS82Jk3R0gIyLbBxxtpjoQqhp5UbLvIPzcoI0=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Wh615s0uY4TLrQvW9jy+sfmQAPECzWGTvBmqiJMEuGJfCVMmH/HBbIsZL5gKfO4+nKDJb4ImulHuuOMxGlVbNzb6L9QYWYSMk0/TAl/jbeGbVWIhXStF1qEdZ7WXqfG+XzxEKUbofw/stYi+TWHmphhbwaOrx1t9iXlFC3jiTZI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hg1QBQJi; 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="hg1QBQJi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E70DCC4CEE2; Wed, 19 Feb 2025 00:59:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926783; bh=duWzI1uS82Jk3R0gIyLbBxxtpjoQqhp5UbLvIPzcoI0=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=hg1QBQJiWMp69LpT4OHKnzBn74Q0uXmrpHNRlj8NNE3yJcy2WJFG/R3HZTcFFQ8Ec WBOBvEUHXaLoQORHvk4v1arLpSkAto7iw5+EAD7g4EFJfTydDeKCnwJhljFtATagcU Ej4uJEgCcgO22iYR6phXkucg91e31rj7E9bHo9B84e1s6aOg14+kv3HPT8iREyOGue Ci2L+15wGi8tWeM14B1hC+DQ+v+aFlkZf89JM9URi4Sf7RU8Pl5kpuIn2Ymf8YymMD QJOfWiHEe2B5f59+8RO95XduXzuqEgIximiNJWnKiiUA1IREz+T9z/BGBXQRvcG0Oe lP79jSAcy9KzQ== Date: Tue, 18 Feb 2025 16:59:42 -0800 Subject: [PATCH 08/15] xfs/206: update mkfs filtering for rt groups feature From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992589327.4079457.1787652822219676386.stgit@frogsfrogsfrogs> In-Reply-To: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> References: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- 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 Wed Feb 19 00:59:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981323 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 11F1E165F1A; Wed, 19 Feb 2025 00:59:58 +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=1739926799; cv=none; b=NAlge0esE7XRhiFJfeIfWSoDq4XxvrgUG+UrP8/C8OdbIc8tSsxq9TAMflChKCbMU5ywTB3umbsITxVzbXDgEfWA+SIMoCwtVKP89iIHJW9gMDc7qqRo3UgCv8/bbJebYJsHJloNelpbGy9XQsdIshkIIxody/0Qz8kx/r+9jdQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926799; c=relaxed/simple; bh=SCiffd5kq9Q8Z57JmZTT07TYPEVmOwaGv2IW7xYMn+I=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=P/jBP64/B3wL4rVIOCuQiasO2XPWZI8IkfgLioBC++ZCSfxF8tyD9r85Qts8Ifc9Vn0p0yXwqWoEO5Oo/oOWbw+am1EP4V12klxHmu8YqF6q7pNAXCgbIqZUHVgTYCjZsy3AjD6wYHm4D4OO3BWPlqXSIGJSKcUy1PNZ0pXtFBI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EHU56o/q; 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="EHU56o/q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CE23C4CEE2; Wed, 19 Feb 2025 00:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926798; bh=SCiffd5kq9Q8Z57JmZTT07TYPEVmOwaGv2IW7xYMn+I=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=EHU56o/qNh4IK4QyHLxI1esUVwofmiTuAg94Rp9nCRMmRgzDzyq6+oVcTz9Nya5jj bqAnQS8stC5pCP8ecypC7P0anNGll5fFxqdQQ7ACBhnvjpOqtZ/smGgSjb/+0Ayi6S 3kKp+B+UU5NAWhzug92Mrer4lKccEYeqwLvGWrQRKPYDcWIy6ixHMFVwSbA8kuf8Jz 7qIMISmZoKvwmplfXthYfh7NojowW5GpBoUJbWH65BYwUaR6wNfZCec4LTHD9ds40G 5E/EmrxkcSOk/wCiMZ+9a072oFOubSLAAJWUaDhGWR3ty8HmaZacc6lgsL38fByLic JXEw08kOKB37g== Date: Tue, 18 Feb 2025 16:59:58 -0800 Subject: [PATCH 09/15] common: pass the realtime device to xfs_db when possible From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992589345.4079457.12014427831544220477.stgit@frogsfrogsfrogs> In-Reply-To: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> References: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- common/xfs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/xfs b/common/xfs index c8f2ea241a2a41..547e91167718e9 100644 --- a/common/xfs +++ b/common/xfs @@ -308,6 +308,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 Wed Feb 19 01:00:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981324 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 A2089190072; Wed, 19 Feb 2025 01:00:14 +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=1739926814; cv=none; b=CMwfqewqiXYz5QGw2+BEGBZJAybBjbt/TIu692/S7tu0eo1L6JWy+fbrnx3JjZUePs0OhMvcKm9J2blOQPRq1KFBcLrYNycbZtNAUARuvr3j3HPqrf1Q0nee1hBAlr8mL5cJjUE8daeOKcGQ+aQwR0MQiD8SiGEdtmi7xSJKw7s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926814; c=relaxed/simple; bh=xoEhcutLggFEZrv8+/ZgQrcuPbQWa3NzM+O892meeg0=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Hz1FTxkT9Pji8365OymYc9nc7cls6oh20MzRv+s0b1cgm7X32y8Ww2n6meoj9sm3HzHA0uzUhcK/Tg5cUpdAiABICDIlOOiwT4FVUVXkkSy+xmveQb5HC4T9ySXYd6pecN3/HzB9jzT75I3aRSvSBXOx6RZUhdMBDc6QsvW1FXw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hMMv3bH9; 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="hMMv3bH9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19556C4CEE2; Wed, 19 Feb 2025 01:00:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926814; bh=xoEhcutLggFEZrv8+/ZgQrcuPbQWa3NzM+O892meeg0=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=hMMv3bH9j8mNDjb1uJgZAWWWQ8R0/KMygh+iXGXi6kHa1R8xTKOpXzOv+wi4GaVMk 7jpnMe2vgg+eMO2CKcguneZCDRrwoLeGaZFRAdkpq5v2MqsEnCYFT22w8Jl0U+IV6c m47c940ZaRjJi7cjln5acCligXGtLtchS4Oh67EZyYXiaDhtYOCv4vlOgAjOZSnLbZ CxTumWjXuYhwZ8iIvE4+tzYdeUGJ0jXj2VV2XMywo5ypowbp+1JLmSLspeAzsakNZ7 aAYWp1pmjMDNyj5ngVJ44bpuonNkXPtIsZ+A17Dhzzy3lu7SzMyfZIq46NnAWQggmK DAYNzTzsGebRA== Date: Tue, 18 Feb 2025 17:00:13 -0800 Subject: [PATCH 10/15] xfs/185: update for rtgroups From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992589364.4079457.14192019317087260403.stgit@frogsfrogsfrogs> In-Reply-To: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> References: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- tests/xfs/185 | 65 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/tests/xfs/185 b/tests/xfs/185 index f3601a5292ef0b..7aceb383ce4609 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 Wed Feb 19 01:00:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981325 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 845BB7DA95; Wed, 19 Feb 2025 01:00: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=1739926830; cv=none; b=O6URUbWI8kz05fpwPPILnw40gKAFtSFav7s9dpYzCpr+QO5S8hUFQ35J0YIf7ftWtWwIXsLyIr5UjfxsJnPuzetxSkRctm8zNOPDwPg2to64q05FNlSVCSxq1dTFLyWLqUIYl5uHVhP0icar+JTMGXlxFsX3XBNJvee914t9Zos= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926830; c=relaxed/simple; bh=y2ABjItUbd32HXtlfAm1Ea3pYTAv4cHjPK7axHPk1jU=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=V6PIEidPsTlkfaN+ubQHjkT7QsiHP46a44jCu1uhbYH//DP8sNXCV6XlbNoDOYvyzQZJILtZAWjVFBWNNxG6gKgHBjuFWrVlfq2AVMUBW6OxMhC/sdPuH5DhbR9R9ztWMOVhB4gncFFKdS9+AYvWxEMDJHOE19B956TQTNfxS4M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tNRtw0tX; 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="tNRtw0tX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3321C4CEE2; Wed, 19 Feb 2025 01:00:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926830; bh=y2ABjItUbd32HXtlfAm1Ea3pYTAv4cHjPK7axHPk1jU=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=tNRtw0tXp2d5bDsBcKqYxmSSWRci3LbNLGBB3pTFvC4kVp/X7k9NZGhLolxJaz56E aLHd4FnVWVttapT+XLOJgtAFwUzpyOQjbR1aIuS283UVruJqkePY1Y8i4S7UgT4xct 8dIISlIhl1pLzdM5FaiyyvFVREL5RNS26GJywBIjIFBQil6wPXnGfDLCR12WC/1YzE S1HpP5eSsbJ9wxC05mZTNqr6Fr1Nu56Wx7q1+F2wA0UZXzsu/XJzTgUR70x7sVaIxu pd6oP0CaLK6R4Eg3vMHZyUHWh4SX3PdHAFdry0dXRXIqpFspIMMghcRyR8uArem81V gXdxdGLoh3Hbw== Date: Tue, 18 Feb 2025 17:00:29 -0800 Subject: [PATCH 11/15] xfs/449: update test to know about xfs_db -R From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992589382.4079457.3244666731390058048.stgit@frogsfrogsfrogs> In-Reply-To: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> References: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- 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 Wed Feb 19 01:00:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981326 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 8208E7DA95; Wed, 19 Feb 2025 01:00: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=1739926846; cv=none; b=Fh9bVsbnfzkM9HLYjFcXKLM30Px4mWBhrUmfmsK5Z84Ii66v4dkU0Gj4jzOxqHiruASfYBQjE4TPebrleizBpWX09c3F03M4LOgW/VfJlUkaNbawuW9fry3aAPgYlBPy3KRBpwDQTrpKlmGJTdQjxeZ2owNYgYkgH5lZsQGMptQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926846; c=relaxed/simple; bh=PJ0wG4kzUFFDoIBvAW8Lc76GLCxurPmCxMq5cRuW8Ok=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qbv9BX/mSNNb8yJVxSy2ToxDROyldjEBps6iGSSFMc47uxX+3fACAKc1SYySUGA+DdfNHCFGd1/MJMiXmulmjdTNEXzsbT/epFT6zAnV27pirYmvrWH/xs0tGv9udAh7EpmGlnZAETqEa/Ch7DBIfmj9YqQy+8MU3I0CzAl+Zro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HHKy2fyz; 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="HHKy2fyz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCE6FC4CEE2; Wed, 19 Feb 2025 01:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926845; bh=PJ0wG4kzUFFDoIBvAW8Lc76GLCxurPmCxMq5cRuW8Ok=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=HHKy2fyzWHiRMs7NGBBgEK4RRKzeVb3B4DLA2xnefzg6/Fg0XPTlXuxwTC0SFNrTu qnJjy9HwLrOIFOsTDg/0V2mnio0/5WZ2jbshlb1FbTI5j4L7dbyc+1ksEqXFmTt2f9 4h+xb+nbN5CRZkV1Sz05BRcf5wPtbWG7nZHwZs5fCpzRGfOMUjBFGdbYz5j5i7Hr7Y Y1TzMUQ0DmjBNq7JT9edRI+DzEhnaMCq8PBdbSIbWnnbmqXaOAZ5Hbmxvs7iK8U47a 9N2p1ImRWwe7IiBgNFf7JzH0lZeIIb1shiKBQOvGrk3hZ3Lyhf6d3K/V0bTY8IMAPS oDKAOMsLGbkwg== Date: Tue, 18 Feb 2025 17:00:45 -0800 Subject: [PATCH 12/15] 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: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992589400.4079457.7456085852406287416.stgit@frogsfrogsfrogs> In-Reply-To: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> References: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- 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 547e91167718e9..5a829637dc1cfb 100644 --- a/common/xfs +++ b/common/xfs @@ -419,6 +419,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 Wed Feb 19 01:01:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981327 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 25B66199FBA; Wed, 19 Feb 2025 01:01: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=1739926862; cv=none; b=UQ5g+Lk8E1cP3E1HObXlmsnmdc4Bu42O57DutzwZ2UR+ZdlzbBp2uLkW6YGS9DgqtmnLuBaZc3BRCKBNYOaRBJnzmejGYI14eS/rql7mkjuXmOnqbqgJOy9UTP7SJB3MnOJGlKmZBO5+d+Vt3tOzOB61vUakCzqIaIn3ESWXXOo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926862; c=relaxed/simple; bh=bhX4iR5LgKi29v4RzC9PQzU+rUhe8fQhHSryhi8i6Bg=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gXwJJxnvAAY3jIelFNwhwtJrAkcjf02JnPi/fpxMztYb4LejEPeS5UO92baoont3OMIDKnEecfsmV4G0guOJBxSxYp+XBiAwUR9F9tXX9EwZTkSb7zoHnlLfOyCnae1mTbuMzZsRF8o0Xl20ritphebgi4V3NqkdnbLedBcs/eU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HNYrYp6u; 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="HNYrYp6u" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B1C9C4CEE2; Wed, 19 Feb 2025 01:01:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926861; bh=bhX4iR5LgKi29v4RzC9PQzU+rUhe8fQhHSryhi8i6Bg=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=HNYrYp6um5tnaD0+xJYMCLaLaas/CXvg6WXWKi9L2clMKavpsaqDtWXRXzB7+N08t MNCVX6AUg02t8tfNFvbwAd7n6Kx17tmkPP17BwlKleQqKGwGcSC5nTNq20XB1yTdrz bGI+Dt0j2qykM0gThkCmRGCCEhY/aKG08qlr4NEaWYrYEVlU7juvmFJ/31VREY+MvR dy4CtJoErMBCj35LzKo6JOzDwka1yqkMxhXdsF/lkcTsmtnh1rzshXU0pRrmweHI8h iKqZTvyNcQ2tBsYBtwokD52vUQpUPtccvt0p8yoFdqYd+P+cHeMP00kgNWKoIVs2he bYBEDCAXo8SXw== Date: Tue, 18 Feb 2025 17:01:00 -0800 Subject: [PATCH 13/15] common/xfs: capture realtime devices during metadump/mdrestore From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992589419.4079457.7193155898233380338.stgit@frogsfrogsfrogs> In-Reply-To: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> References: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- common/metadump | 22 ++++++++++++++++++---- common/populate | 6 +++++- common/xfs | 48 ++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 63 insertions(+), 13 deletions(-) diff --git a/common/metadump b/common/metadump index a4ec9a7f921acf..61ba3cbb91647c 100644 --- a/common/metadump +++ b/common/metadump @@ -27,6 +27,7 @@ _xfs_cleanup_verify_metadump() if [ -n "$XFS_METADUMP_IMG" ]; then [ -b "$METADUMP_DATA_LOOP_DEV" ] && _destroy_loop_device $METADUMP_DATA_LOOP_DEV [ -b "$METADUMP_LOG_LOOP_DEV" ] && _destroy_loop_device $METADUMP_LOG_LOOP_DEV + [ -b "$METADUMP_RT_LOOP_DEV" ] && _destroy_loop_device $METADUMP_RT_LOOP_DEV for img in "$XFS_METADUMP_IMG"*; do test -e "$img" && rm -f "$img" done @@ -101,6 +102,7 @@ _xfs_verify_metadump_v2() local version="-v 2" local data_img="$XFS_METADUMP_IMG.data" local log_img="" + local rt_img="" # Capture metadump, which creates metadump_file _scratch_xfs_metadump $metadump_file $metadump_args $version @@ -111,8 +113,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 @@ -121,12 +127,15 @@ _xfs_verify_metadump_v2() # Create loopdev for log device if we recovered anything test -s "$log_img" && METADUMP_LOG_LOOP_DEV=$(_create_loop_device $log_img) + # Create loopdev for rt device if we recovered anything + test -s "$rt_img" && METADUMP_RT_LOOP_DEV=$(_create_loop_device $rt_img) + # Mount fs, run an extra test, fsck, and unmount - SCRATCH_DEV=$METADUMP_DATA_LOOP_DEV SCRATCH_LOGDEV=$METADUMP_LOG_LOOP_DEV _scratch_mount + SCRATCH_DEV=$METADUMP_DATA_LOOP_DEV SCRATCH_LOGDEV=$METADUMP_LOG_LOOP_DEV SCRATCH_RTDEV=$METADUMP_RT_LOOP_DEV _scratch_mount if [ -n "$extra_test" ]; then - SCRATCH_DEV=$METADUMP_DATA_LOOP_DEV SCRATCH_LOGDEV=$METADUMP_LOG_LOOP_DEV $extra_test + SCRATCH_DEV=$METADUMP_DATA_LOOP_DEV SCRATCH_LOGDEV=$METADUMP_LOG_LOOP_DEV SCRATCH_RTDEV=$METADUMP_RT_LOOP_DEV $extra_test fi - SCRATCH_DEV=$METADUMP_DATA_LOOP_DEV SCRATCH_LOGDEV=$METADUMP_LOG_LOOP_DEV _check_xfs_scratch_fs + SCRATCH_DEV=$METADUMP_DATA_LOOP_DEV SCRATCH_LOGDEV=$METADUMP_LOG_LOOP_DEV SCRATCH_RTDEV=$METADUMP_RT_LOOP_DEV _check_xfs_scratch_fs _unmount $METADUMP_DATA_LOOP_DEV # Tear down what we created @@ -135,6 +144,11 @@ _xfs_verify_metadump_v2() unset METADUMP_LOG_LOOP_DEV rm -f $log_img fi + if [ -b "$METADUMP_RT_LOOP_DEV" ]; then + _destroy_loop_device $METADUMP_RT_LOOP_DEV + unset METADUMP_RT_LOOP_DEV + rm -f $rt_img + fi _destroy_loop_device $METADUMP_DATA_LOOP_DEV unset METADUMP_DATA_LOOP_DEV rm -f $data_img diff --git a/common/populate b/common/populate index 9fc1ee32bd490d..a77d1b0f5f3873 100644 --- a/common/populate +++ b/common/populate @@ -1061,12 +1061,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 5a829637dc1cfb..a94b9de032f932 100644 --- a/common/xfs +++ b/common/xfs @@ -625,14 +625,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" ] && @@ -656,7 +661,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 @@ -684,6 +690,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}" } @@ -697,17 +715,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 @@ -716,6 +744,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 @@ -726,7 +755,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 @@ -847,7 +879,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. @@ -880,7 +912,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 @@ -964,7 +996,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 Wed Feb 19 01:01:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981348 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 D0F441A08B5; Wed, 19 Feb 2025 01:01: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=1739926877; cv=none; b=mdhx6Ixa6DFwRZDwD95BIOiNh75aR0+f8uUKuWCn77c3rWeHFh+17b0p8volTsgGzX25uCKQWPampctC4dgGhgd5fi08u96EGk9JZ6bcWnvDXOX58OKikl74yj92NluP+/nYBrmGmQ2IjW5+mFTWqUSLonrUQRfBcdXN2IP+HEE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926877; c=relaxed/simple; bh=l6CPkU+TjVuSPLV2FkIlrDWhPxfVeHjcB8mc9NPhdcw=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=D4jXsQ3NguUwG+5ZJ2zip4Y5gLhJYJUbdxmki8c+0FCoBwPLaEdZSqiH9Cj/79unfSAEcbs9lG0TMJ26FeL16WVj8uTJIK3oYvNj3EqDFq8RDnLF06gSaTeSacXLJROxOVMPNK6Hkavau7uf4FeFr7OxIO0KPCJeF8XjCoQiCoo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZepLSwAg; 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="ZepLSwAg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3322CC4CEE2; Wed, 19 Feb 2025 01:01:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926877; bh=l6CPkU+TjVuSPLV2FkIlrDWhPxfVeHjcB8mc9NPhdcw=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=ZepLSwAgL8179/52+emZ53cnB7WFtDCdz37FAoM1vZGP54bJqARM7x+4R/h5IX48g ffMSBsBiq2p+KKgKIJqrBJ9pguMHyUbdshgxESVUr9JuagDHbLSuwOMZCj2BHz2oci wdgl4umgWsWvvxN9JLMLo6fVXLQqvv5VPWO3RaG2RQmGmJHYw9cbyPx8bsFyAYe1rz gvRh1jp70Y8qLru/dFpecz6FDnFRi02O4IB1ErHMuatwoQs6GC99XTryS4ATfFHaDf 4Y5wdE4jG+tJVi+PLPPazh2DPsOXIM+Y6Xhthv1YW/crj2eZxuCsx4m+13RAeUElFY L3hWP77pglDoA== Date: Tue, 18 Feb 2025 17:01:16 -0800 Subject: [PATCH 14/15] common/fuzzy: adapt the scrub stress tests to support rtgroups From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992589437.4079457.14723541149706284576.stgit@frogsfrogsfrogs> In-Reply-To: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> References: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- 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 1548f372fac58a..a57b076ef9670a 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 @@ -1298,7 +1306,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 @@ -1328,6 +1338,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" @@ -1353,6 +1367,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. @@ -1399,6 +1414,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="" @@ -1406,12 +1422,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";; @@ -1422,7 +1439,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 @@ -1483,7 +1500,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 a94b9de032f932..1e415a4eb3ed68 100644 --- a/common/xfs +++ b/common/xfs @@ -1490,6 +1490,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 39eb42da4b10c5..6aa360b37b90c5 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 68a6c7f6e2d584..97b3d2579cbd7f 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 217f96092a4c42..e7004705b526a5 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 Wed Feb 19 01:01:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981349 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 5D511188938; Wed, 19 Feb 2025 01:01:32 +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=1739926893; cv=none; b=jd/epO9jhYGIvLSvv9GeNRixYLXvl/1P3Y2gFbm+jl7u8zBeCNFxgjrb0MjprOLCRVCSaUJ5YyOvgUEMrdiRAo8l5xedgo17mrTl1SyxVcpba4Ji39hCsfTCCxBEui+GOWPHUsyfNJSE7icbNrQKjRuJ2AEPBV8LxlN7iDylbpY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926893; c=relaxed/simple; bh=yMfp5PGksSGw6GlguVNzLonSAiq8DhT0MwFVPV8lRuA=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WUsZ1bPSkNCBMKKKurw9n4wm5CBKtWItGPzOP+BorKA//Dwvoh2C+EylDMl0CNYiTl/qzLHBEgt5GZKs7WnAuud5hTHN2ms8gBCgTF9yS4LIsWaeYg0EoeI0iuLFylhvMZsUr0Rz2HM0FPqyQKPKo/YoYn8fWG37wxqRwHsTPds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GKDHH2LQ; 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="GKDHH2LQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8468C4CEE2; Wed, 19 Feb 2025 01:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926892; bh=yMfp5PGksSGw6GlguVNzLonSAiq8DhT0MwFVPV8lRuA=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=GKDHH2LQZG1MAbyDdWppX2VWia2nGX49st+WxsJfNH8oCfBVn8kw6BH7d17NT2fS3 6lhwr7P+Uskja7mMjtwVExRq4VrHwnFpByT9SOU2aoSiNANeg8fiG1qR686nCuZpXv fdKNVHzw/Tnn0O4OENLRNR8iu/GKY3ynz6CYNGl5x/iEZAxZNgorwdQoENambr6PLA JjSsLqSHBRhAONMukkAdfpXGSUqZNIirAL8RMF3/R9xM5eXbZKtc/69tjHrILnDOnV Sg+xRvcTWhqa/VBKN0FwH6z71gX/tp0q0lPsuWJq5w6DwpS/v5e19hXQo1WWTyvBKn OshTS7ljB5Gtw== Date: Tue, 18 Feb 2025 17:01:32 -0800 Subject: [PATCH 15/15] xfs: fix fuzz tests of rtgroups bitmap and summary files From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992589456.4079457.14720380754325984212.stgit@frogsfrogsfrogs> In-Reply-To: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> References: <173992589108.4079457.2534756062525120761.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- 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 1e415a4eb3ed68..97bdf8575a4bd4 100644 --- a/common/xfs +++ b/common/xfs @@ -1950,6 +1950,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 6aa360b37b90c5..7d79dbcad70149 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 e92f128f8a5695..a2cc58c04bf8d2 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 5fd6caa5bce2f8..77cceac7ac7f02 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 c8990034773b32..fe5d054956d5e2 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 96c2315c524311..35f78aab7faead 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 301ae7b9574320..04087c1a224558 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 039624f711c0a6..1e70147fa3bcef 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 13f63b9ceb1756..0db3dd617c2d1f 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 56a6d58ef9f4ca..acfbe72597fd5a 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 935b2e5acba5d4..0d1ab895aacd62 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 a779bf81738537..07c64e7a3f9744 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