Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 4137D1DA61B; Thu, 1 May 2025 13:43:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746106993; cv=none; b=QEW/xFopJX15HpLEKJQulWSGgHnp85G1oCcVEkdRxprA6HPsYmG9vSG8uoChh6OEX7nR34C9fraATT896fX4noGkH7THrxbycoT8iI9r7m09c4raHU3OI7b6ccOGAG274byRl3dZM+XjfIwZD2I0amwdNUPNIfifLR15bvMWHWc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746106993; c=relaxed/simple; bh=OTPoT4Miwm6XZa021cBYDl7MEsq/kGW5pNQW0jIB7BQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GE/Uu6WT3vfNVPT++1HggNnMlTroG0PpgttwRA2WbvsK37vrOj96Wzv3uW3JAE2TWtBEMJITmf+fUjMJLm6UAWPfzQ2Ga3LGiEhXw6jBEXuqOglbISQQPB+CEkG741Xfi12G61iEmkjTtisVn5NmSVasbdTpzQK0gd/rr26tzrE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=lX/RVrUf; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="lX/RVrUf" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=TfY+cnuHmVPADiaJqyVTvTiqFHjS9TXN5PBMpzanVI4=; b=lX/RVrUfcTN0/zs422hgPoddLA +G5XQGv7Bib1TfKAO1Kj2wkF5D5xEo/3l3ciUoY34L2CmyfDwJkEXzCo8nuKwi+xrfO5rBFvXg3xa LS41HI2n7rOHn4iR2RlQF2foGXqMz1oYj6dLpp9J7DfXuhxsuR/mjs1K27fyReU81f4BuYAN8Vz7I lAPAzQxOiXUsXMvVA+TrT1exGISJOVvmKVauNVVynQ1VKza+Fgcaof9wDut5GXeCt/hUfoHGzbBuc 1uu7GzIM3/BRCopKSnS/wcJZnoo9ceuGihft1lOcDoM+la4OHdiyzGfUle5BzInrzQxkArqLVBkZM aGh2XxtQ==; Received: from [104.254.106.146] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1uAUBz-0000000FrRw-3gjl; Thu, 01 May 2025 13:43:12 +0000 From: Christoph Hellwig To: Zorro Lang Cc: "Darrick J. Wong" , Hans Holmberg , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH 11/15] xfs: test zoned GC file defragmentation for sequential writers Date: Thu, 1 May 2025 08:42:48 -0500 Message-ID: <20250501134302.2881773-12-hch@lst.de> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250501134302.2881773-1-hch@lst.de> References: <20250501134302.2881773-1-hch@lst.de> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Test that zoned GC defragments sequential writers forced into the same zone. Signed-off-by: Christoph Hellwig --- tests/xfs/4210 | 124 +++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/4210.out | 5 ++ 2 files changed, 129 insertions(+) create mode 100755 tests/xfs/4210 create mode 100644 tests/xfs/4210.out diff --git a/tests/xfs/4210 b/tests/xfs/4210 new file mode 100755 index 000000000000..2984339fd86e --- /dev/null +++ b/tests/xfs/4210 @@ -0,0 +1,124 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Christoph Hellwig. +# +# FS QA Test No. 4210 +# +# Test that GC defragments sequentially written files. +# +. ./common/preamble +_begin_fstest auto rw zone + +_cleanup() +{ + cd / + _scratch_unmount >/dev/null 2>&1 +} + +# Import common functions. +. ./common/filter +. ./common/zoned + +_require_scratch + +_scratch_mkfs_sized $((256 * 1024 * 1024)) >>$seqres.full 2>&1 + +# limit to two max open zones so that all writes get thrown into the blender +export MOUNT_OPTIONS="$MOUNT_OPTIONS -o max_open_zones=2" +_try_scratch_mount || _notrun "mount option not supported" +_require_xfs_scratch_zoned + +fio_config=$tmp.fio +fio_out=$tmp.fio.out +fio_err=$tmp.fio.err + +cat >$fio_config <> $seqres.full + +# fill up all remaining user capacity +dd if=/dev/zero of=$SCRATCH_MNT/fill bs=4k >> $seqres.full 2>&1 + +sync + +# all files should be badly fragmented now +extents2=$(_count_extents $SCRATCH_MNT/file2) +echo "number of file 2 extents: $extents2" >>$seqres.full +test $extents2 -gt 200 || _fail "fio did not fragment file" + +extents4=$(_count_extents $SCRATCH_MNT/file4) +echo "number of file 4 extents: $extents4" >>$seqres.full +test $extents4 -gt 200 || _fail "fio did not fragment file" + +extents6=$(_count_extents $SCRATCH_MNT/file6) +echo "number of file 6 extents: $extents6" >>$seqres.full +test $extents6 -gt 200 || _fail "fio did not fragment file" + +extents8=$(_count_extents $SCRATCH_MNT/file8) +echo "number of file 8 extents: $extents8" >>$seqres.full +test $extents8 -gt 200 || _fail "fio did not fragment file" + +# remove half of the files to create work for GC +rm $SCRATCH_MNT/file1 +rm $SCRATCH_MNT/file3 +rm $SCRATCH_MNT/file5 +rm $SCRATCH_MNT/file7 + +# fill up all remaining user capacity a few times to force GC +for i in `seq 1 10`; do + dd if=/dev/zero of=$SCRATCH_MNT/fill bs=4k >> $seqres.full 2>&1 + $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/fill >> $seqres.full 2>&1 +done + +# +# All files should have a no more than a handful of extents now +# +extents2=$(_count_extents $SCRATCH_MNT/file2) +_within_tolerance "file 2 extents" $extents2 3 2 -v +extents4=$(_count_extents $SCRATCH_MNT/file4) +_within_tolerance "file 4 extents" $extents4 3 2 -v +extents6=$(_count_extents $SCRATCH_MNT/file6) +_within_tolerance "file 6 extents" $extents6 3 2 -v +extents8=$(_count_extents $SCRATCH_MNT/file8) +_within_tolerance "file 8 extents" $extents8 3 2 -v + +status=0 +exit diff --git a/tests/xfs/4210.out b/tests/xfs/4210.out new file mode 100644 index 000000000000..488dd9db790b --- /dev/null +++ b/tests/xfs/4210.out @@ -0,0 +1,5 @@ +QA output created by 4210 +file 2 extents is in range +file 4 extents is in range +file 6 extents is in range +file 8 extents is in range -- 2.47.2