From patchwork Tue May 2 20:08:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13229256 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E6E4C7EE2C for ; Tue, 2 May 2023 20:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229743AbjEBUIQ (ORCPT ); Tue, 2 May 2023 16:08:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229797AbjEBUIO (ORCPT ); Tue, 2 May 2023 16:08:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 498861997; Tue, 2 May 2023 13:08:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D9A616231D; Tue, 2 May 2023 20:08:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 405B2C433EF; Tue, 2 May 2023 20:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683058092; bh=eyu26KMZnGh1HL4k2AjRl/yPU+tUlilpDF+9z5uJZIY=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Hd+EXCKe8xjtjJ7fVQt83qVwAR3YyC9Lagbc8Q2e9X5sTjDEGbRvlL2VztKar99ZP wx1XfX6hDO3Mil37grw5O3ejhKAVyEDyS6QToPJCzWOhr81bdhG5uLLoVuHhN7vXX/ FPl9z1XYhkD2i5+5OOWuE0/0ZauhZ6sfbVGKPNxGv3ynuqpU5ArMSA3Oiqe6mPMKed VMOYEfKN10yjxkuT4rMBjE6wjTRNFnzskFwT0EwrnQDqDZNE10rATzyLpW55/yhuAg L3xjq0U5SmsBRSUDVNnkA00X54IOvc3Fip5qwCGwlPOCfpTg8eW5cT1jsIwfCR2Vvf OySeAKD4pXKNQ== Subject: [PATCH 1/7] fsx: fix indenting of columns in bad buffers report From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Tue, 02 May 2023 13:08:11 -0700 Message-ID: <168305809174.331137.660744527774559430.stgit@frogsfrogsfrogs> In-Reply-To: <168305808594.331137.16455277063177572891.stgit@frogsfrogsfrogs> References: <168305808594.331137.16455277063177572891.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong When file corruption is detected, make the columns of the report line up correctly even in the diff output. Although the .out.bad file contains this (with spaces to demonstrate unequivocally what happens when tabs are formatted as 8-column indent): OFFSET GOOD BAD RANGE 0x2c000 0x0000 0xd6c1 0x00000 diffing the good and bad golden output yields poorly formatted output: +OFFSET GOOD BAD RANGE +0x2c000 0x0000 0xd6c1 0x00000 Replace the tabs with columns indented with printf width specifiers so that the test output gets this: OFFSET GOOD BAD RANGE 0x2c000 0x0000 0xd6c1 0x0 ...which always lines up the columns regardless of the user's tab display settings or diff inserting plus signs. Signed-off-by: Darrick J. Wong --- ltp/fsx.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ltp/fsx.c b/ltp/fsx.c index c76b06ca76..ffa64cfa00 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -669,17 +669,18 @@ check_buffers(char *buf, unsigned offset, unsigned size) if (memcmp(good_buf + offset, buf, size) != 0) { prt("READ BAD DATA: offset = 0x%x, size = 0x%x, fname = %s\n", offset, size, fname); - prt("OFFSET\tGOOD\tBAD\tRANGE\n"); + prt("%-10s %-6s %-6s %s\n", "OFFSET", "GOOD", "BAD", "RANGE"); while (size > 0) { c = good_buf[offset]; t = buf[i]; if (c != t) { if (n < 16) { bad = short_at(&buf[i]); - prt("0x%05x\t0x%04x\t0x%04x", offset, - short_at(&good_buf[offset]), bad); + prt("0x%-8x 0x%04x 0x%04x 0x%x\n", + offset, + short_at(&good_buf[offset]), bad, + n); op = buf[offset & 1 ? i+1 : i]; - prt("\t0x%05x\n", n); if (op) prt("operation# (mod 256) for " "the bad data may be %u\n", From patchwork Tue May 2 20:08:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13229257 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98337C77B73 for ; Tue, 2 May 2023 20:08:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229800AbjEBUIV (ORCPT ); Tue, 2 May 2023 16:08:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229809AbjEBUIU (ORCPT ); Tue, 2 May 2023 16:08:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3F5B210D; Tue, 2 May 2023 13:08:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7B25062888; Tue, 2 May 2023 20:08:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3CECC4339E; Tue, 2 May 2023 20:08:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683058097; bh=5ABbv8yncK7msy6e4ZUOITGdL3qMVbaycFKsVkxfqsc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=THA6w3XdsSB08LPLednR0P5wJWn+SlfbE+VeERq41PWjSaHrS9ss5RiI9jcBa7SDc 3/lUMC0adNhckSOXLiELuDX5v2M2mPyIi20vob5SaqVJ3DHeBToBgSiZSFK09prtjT zThPRbWgbYVuF7yAmP3keYX+5E55SJGmSbgHQvwdgOrCQXmS6QwSYJZl+0YFTJ8Jnl 7Lq5W+7mU2rAggLqBqs5emEeqraCfhYJUQ3XyCwxzm2F4iJFvQG6i2w2hFtHjrHswX 33KaJ0VeJBKeA1xUd0zDi3glt3cHE6Su2BbtR27am5YEjKkBZ0xDE33pLlDKK1c75T 2r7H0VOtqqukg== Subject: [PATCH 2/7] xfs/262: remove dangerous labels From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Tue, 02 May 2023 13:08:17 -0700 Message-ID: <168305809743.331137.7433555907275247899.stgit@frogsfrogsfrogs> In-Reply-To: <168305808594.331137.16455277063177572891.stgit@frogsfrogsfrogs> References: <168305808594.331137.16455277063177572891.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong This test starts with a consistent filesystem and should end that way too. In other words, it isn't dangerous, so drop that from the tags. Signed-off-by: Darrick J. Wong --- tests/xfs/262 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/xfs/262 b/tests/xfs/262 index 78db5e3421..b28a6c88b7 100755 --- a/tests/xfs/262 +++ b/tests/xfs/262 @@ -9,7 +9,7 @@ # executable and libraries!) to see what happens. # . ./common/preamble -_begin_fstest dangerous_fuzzers dangerous_scrub dangerous_online_repair +_begin_fstest fuzzers scrub online_repair _register_cleanup "_cleanup" BUS From patchwork Tue May 2 20:08:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13229258 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F2B9C77B73 for ; Tue, 2 May 2023 20:08:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229809AbjEBUI3 (ORCPT ); Tue, 2 May 2023 16:08:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229823AbjEBUI2 (ORCPT ); Tue, 2 May 2023 16:08:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A547A210C; Tue, 2 May 2023 13:08:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 317BE62878; Tue, 2 May 2023 20:08:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85C11C4339B; Tue, 2 May 2023 20:08:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683058103; bh=6+md2K/UJnbMGna7CHfnm9w7lC5HIsKO+Q8dM96V6w8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Om8NNCL9ZsIUlr+hUWxVUrNSFhkNAmZU8Mk6odGweovgfLxlMYfiIcFOZwWN82Xzd zeUoDixrQfOp0+N8kyq/sAeBXr5wIniNCALg/xgvZGUcCqatdy1xeJXLXYDBTZb5/0 xoZFeCYker1P7iSWzDqBIfFd2MamIWcOvr7EPwYnT1IR9wXaRVoVeKw5RfZHjs71II PkYkGtL25oNyJddHfRDeuddrwDrmJwIkB8iia7RFj8RTUSDcepmJ1D2pYhk7ThOpp7 1pbcGawXs7bSEZ+RbtJvwmy7P4YK7PulJZWtbhC/OWmtKCIxt39846epAG0VZ53VWj /pgfG3ipIBd8w== Subject: [PATCH 3/7] generic/724,xfs/791: adjust test preconditions for post-EOF stripe zeroing From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Tue, 02 May 2023 13:08:23 -0700 Message-ID: <168305810303.331137.12116775179614442990.stgit@frogsfrogsfrogs> In-Reply-To: <168305808594.331137.16455277063177572891.stgit@frogsfrogsfrogs> References: <168305808594.331137.16455277063177572891.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong I recently introduced a new fstests config with explicitly specified stripe geometry of 128k stripe units and a stripe width of 4. This broke both of these tests because I hadn't counted on a few things: 1) The write to $SCRATCH_MNT/b at 768k would a 128k delalloc extent 2) This delalloc extent would extend beyond EOF 3) Increasing the file size from 832k to 1m would cause iomap to zero the pagecache for the parts of the delalloc extent beyond EOF 4) The newly dirtied posteof delalloc areas would get written to disk with a real space allocation Under these circumstances, FIEXCHRANGE with SKIP_FILE1_HOLES sees a written extent containing zeroes in file B between 832k and 1m. File A has a written extent containing 'X' in the same range, so it exchanges the two. When RAID geometry is disabled, the area between 832k and 1m is usually a hole, so FIEXCHRANGE does nothing. This causes the md5sum of the two files to be different, and the test fails. Fix the test by truncating B to 1m before writing anything to it. Signed-off-by: Darrick J. Wong --- tests/generic/724 | 2 +- tests/xfs/791 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/generic/724 b/tests/generic/724 index 90cff8cf31..8d7dc4e12a 100755 --- a/tests/generic/724 +++ b/tests/generic/724 @@ -33,9 +33,9 @@ _require_congruent_file_oplen $SCRATCH_MNT 65536 _pwrite_byte 0x58 0 1m $SCRATCH_MNT/a >> $seqres.full # Create the donor file +$XFS_IO_PROG -f -c 'truncate 1m' $SCRATCH_MNT/b _pwrite_byte 0x59 64k 64k $SCRATCH_MNT/b >> $seqres.full _pwrite_byte 0x57 768k 64k $SCRATCH_MNT/b >> $seqres.full -$XFS_IO_PROG -c 'truncate 1m' $SCRATCH_MNT/b md5sum $SCRATCH_MNT/a | _filter_scratch md5sum $SCRATCH_MNT/b | _filter_scratch diff --git a/tests/xfs/791 b/tests/xfs/791 index c89bc3531e..d82314ee08 100755 --- a/tests/xfs/791 +++ b/tests/xfs/791 @@ -37,9 +37,9 @@ _require_congruent_file_oplen $SCRATCH_MNT 65536 _pwrite_byte 0x58 0 1m $SCRATCH_MNT/a >> $seqres.full # Create the donor file +$XFS_IO_PROG -f -c 'truncate 1m' $SCRATCH_MNT/b _pwrite_byte 0x59 64k 64k $SCRATCH_MNT/b >> $seqres.full _pwrite_byte 0x57 768k 64k $SCRATCH_MNT/b >> $seqres.full -$XFS_IO_PROG -c 'truncate 1m' $SCRATCH_MNT/b sync md5sum $SCRATCH_MNT/a | _filter_scratch From patchwork Tue May 2 20:08:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13229259 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1110DC77B78 for ; Tue, 2 May 2023 20:08:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229803AbjEBUIi (ORCPT ); Tue, 2 May 2023 16:08:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229818AbjEBUIg (ORCPT ); Tue, 2 May 2023 16:08:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92A6D1BDF; Tue, 2 May 2023 13:08:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 29D6D6213D; Tue, 2 May 2023 20:08:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4808FC433D2; Tue, 2 May 2023 20:08:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683058109; bh=9dtzW82U9sgJXUIYWTxVoYjFxL7VG+haXr7WmnPrLOA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=pTRLwf+9MUl2btLX0TaIcgTj8RlqziYG1LdxO3PeEIZg242vMhzF0suQ0iy2+zhnM aH+hAyukgcsfWR0j3o9wHJgBhjMY9+tDcnFAhHVY5WsPPvpiV/rpo/P1Q1JaO5J/W7 a/ILNybcUTQ5XWHb1UI6igXWKIxRYdI/C/fPjyUbBhkcHrYviqo/3nK1sBAaDFtoKw ixb8W0WM29mJpqSFEdJseQ1LHwOYehxI4dGkw+OkB+9s+WynBshOVNjGF7XWn4Hvft u3cmc65Xh72CS8wMmjH/9q7qa+dZhGrx3cOHW3TM5w4tHkZUYBk6UOYeffhn8/zCkK t1TsZo0OiReMg== Subject: [PATCH 4/7] xfs/{243,245,272,274}: ignore raid alignment flags in bmap output From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Tue, 02 May 2023 13:08:28 -0700 Message-ID: <168305810873.331137.15436349640460378478.stgit@frogsfrogsfrogs> In-Reply-To: <168305808594.331137.16455277063177572891.stgit@frogsfrogsfrogs> References: <168305808594.331137.16455277063177572891.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong This test doesn't care about the RAID alignment status of the mappings that it finds; it only cares about shared and unwritten. Ignore the mapping stripe alignment flags in the bmapx output. This fixes this test when the fs has su=128k,sw=4. Signed-off-by: Darrick J. Wong --- tests/xfs/243 | 12 ++++++------ tests/xfs/245 | 6 +++--- tests/xfs/272 | 4 ++-- tests/xfs/274 | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/xfs/243 b/tests/xfs/243 index 514fa35667..2e537f3f55 100755 --- a/tests/xfs/243 +++ b/tests/xfs/243 @@ -92,16 +92,16 @@ echo "Delayed allocation CoW extents:" test $(_xfs_bmapx_find cow $testdir/file3 delalloc) -gt 0 || \ echo "Expected to find a delalloc CoW extent" echo "Shared data extents:" -test $(_xfs_bmapx_find data $testdir/file3 '100000$') -gt 0 || \ +test $(_xfs_bmapx_find data $testdir/file3 -E '10[01]{4}$') -gt 0 || \ echo "Expected to find a shared data extent" echo "Unwritten data extents:" -test $(_xfs_bmapx_find data $testdir/file3 '10000$') -gt 0 || \ +test $(_xfs_bmapx_find data $testdir/file3 -E '1[01]{4}$') -gt 0 || \ echo "Expected to find an unwritten data extent" echo "Hole data extents:" test $(_xfs_bmapx_find data $testdir/file3 hole) -gt 0 || \ echo "Expected to find a hole data extent" echo "Regular data extents:" -test $(_xfs_bmapx_find data $testdir/file3 '000000$') -gt 0 || \ +test $(_xfs_bmapx_find data $testdir/file3 -E '00[01]{4}$') -gt 0 || \ echo "Expected to find a regular data extent" sync @@ -115,16 +115,16 @@ echo "Real CoW extents:" test $(_xfs_bmapx_find cow $testdir/file3 delalloc ) -eq 0 || \ echo "Expected to find zero delalloc CoW extent" echo "Shared data extents:" -test $(_xfs_bmapx_find data $testdir/file3 '100000$') -gt 0 || \ +test $(_xfs_bmapx_find data $testdir/file3 -E '10[01]{4}$') -gt 0 || \ echo "Expected to find a shared data extent" echo "Unwritten data extents:" -test $(_xfs_bmapx_find data $testdir/file3 '10000$') -gt 0 || \ +test $(_xfs_bmapx_find data $testdir/file3 -E '1[01]{4}$') -gt 0 || \ echo "Expected to find an unwritten data extent" echo "Hole data extents:" test $(_xfs_bmapx_find data $testdir/file3 hole) -gt 0 || \ echo "Expected to find a hole data extent" echo "Regular data extents:" -test $(_xfs_bmapx_find data $testdir/file3 '000000$') -gt 0 || \ +test $(_xfs_bmapx_find data $testdir/file3 -E '00[01]{4}$') -gt 0 || \ echo "Expected to find a regular data extent" _scratch_cycle_mount diff --git a/tests/xfs/245 b/tests/xfs/245 index 0cd0935cfa..595a5938b4 100755 --- a/tests/xfs/245 +++ b/tests/xfs/245 @@ -42,17 +42,17 @@ md5sum $testdir/file1 | _filter_scratch md5sum $testdir/file2 | _filter_scratch echo "Unwritten data extents" -test $(_xfs_bmapx_find data $testdir/file1 '10000$') -gt 0 || \ +test $(_xfs_bmapx_find data $testdir/file1 -E '1[01]{4}$') -gt 0 || \ echo "Expected to find an unwritten file1 extent" echo "Shared data extents" -test $(_xfs_bmapx_find data $testdir/file1 '100000$') -gt 0 || \ +test $(_xfs_bmapx_find data $testdir/file1 -E '10[01]{4}$') -gt 0 || \ echo "Expected to find a shared data extent" echo "Hole data extents" test $(_xfs_bmapx_find data $testdir/file2 'hole') -gt 0 || \ echo "Expected to find a hole data extent" echo "Shared data extents" -test $(_xfs_bmapx_find data $testdir/file2 '100000$') -gt 0 || \ +test $(_xfs_bmapx_find data $testdir/file2 -E '10[01]{4}$') -gt 0 || \ echo "Expected to find a shared data extent" echo "Hole cow extents" diff --git a/tests/xfs/272 b/tests/xfs/272 index 7ed8b95122..c68fa9d614 100755 --- a/tests/xfs/272 +++ b/tests/xfs/272 @@ -49,10 +49,10 @@ $XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/urk | grep '^[[:space:]]*[0-9]*:' | grep echo "Check bmap and fsmap" | tee -a $seqres.full cat $TEST_DIR/bmap | while read ext offrange colon blockrange ag agrange total crap; do - qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total}$" + qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total}(| [01]*)$" echo "${qstr}" >> $seqres.full grep "${qstr}" $TEST_DIR/fsmap >> $seqres.full - found=$(grep -c "${qstr}" $TEST_DIR/fsmap) + found=$(grep -E -c "${qstr}" $TEST_DIR/fsmap) test $found -eq 1 || echo "Unexpected output for offset ${offrange}." done diff --git a/tests/xfs/274 b/tests/xfs/274 index dcaea68804..cd483d77bc 100755 --- a/tests/xfs/274 +++ b/tests/xfs/274 @@ -49,10 +49,10 @@ $XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/f1 | grep '^[[:space:]]*[0-9]*:' | grep - echo "Check f1 bmap and fsmap" | tee -a $seqres.full cat $TEST_DIR/bmap | while read ext offrange colon blockrange ag agrange total crap; do - qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total} 0100000$" + qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total} 010[01]{4}$" echo "${qstr}" >> $seqres.full grep "${qstr}" $TEST_DIR/fsmap >> $seqres.full - found=$(grep -c "${qstr}" $TEST_DIR/fsmap) + found=$(grep -E -c "${qstr}" $TEST_DIR/fsmap) test $found -eq 1 || echo "Unexpected output for offset ${offrange}." done @@ -62,10 +62,10 @@ $XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/f2 | grep '^[[:space:]]*[0-9]*:' | grep - echo "Check f2 bmap and fsmap" | tee -a $seqres.full cat $TEST_DIR/bmap | while read ext offrange colon blockrange ag agrange total crap; do - qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total} 0100000$" + qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total} 010[01]{4}$" echo "${qstr}" >> $seqres.full grep "${qstr}" $TEST_DIR/fsmap >> $seqres.full - found=$(grep -c "${qstr}" $TEST_DIR/fsmap) + found=$(grep -E -c "${qstr}" $TEST_DIR/fsmap) test $found -eq 1 || echo "Unexpected output for offset ${offrange}." done From patchwork Tue May 2 20:08:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13229260 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7265EC77B78 for ; Tue, 2 May 2023 20:08:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229828AbjEBUIu (ORCPT ); Tue, 2 May 2023 16:08:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229822AbjEBUIq (ORCPT ); Tue, 2 May 2023 16:08:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50F871BD5; Tue, 2 May 2023 13:08:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C23F462878; Tue, 2 May 2023 20:08:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A53FC433D2; Tue, 2 May 2023 20:08:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683058115; bh=Kd3qyC5lxmDsr90OyCxPZaLyRlym3tPIV2Ycmv7Yab8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=fR+4uwOT0uhZZzveLH7dSvxE9yDSIa8eIDIYxwZpd2MpXNZjbWSButFQ4Og1cmqA5 UlYdGjqFv5hw/PYh4FNdvV/ybsAw6vWNQIz99C6P2x8ttypjtEjpaYPo935ptBwWwa aH5bCgOXuZ0Ivfe02NBs+BcKjvnSXL7jrzb9EEMdU3nZ1K7tkQwQqpz/OfFdd+QhOm zxN8xZF0vM/RKpLor+AuNbnG+9TU0K8Co5wt4QNU/e49c0BFohcrWxE8C1De31xgfF g2fFnJeYNZinSlw+F5RhfFi6+ZQ9Qmg78KduYuobKVseNSQBC7sdNh34IwSiOl48el xQQ7ZrvOZd67g== Subject: [PATCH 5/7] fiemap-tester: holes can be backed by unwritten extents From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Tue, 02 May 2023 13:08:34 -0700 Message-ID: <168305811472.331137.10386168929752413533.stgit@frogsfrogsfrogs> In-Reply-To: <168305808594.331137.16455277063177572891.stgit@frogsfrogsfrogs> References: <168305808594.331137.16455277063177572891.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Filesystem behavior is pretty open-ended for sparse ranges (i.e. holes) of a file that have not yet been written to. That space can remain unmapped, it can be mapped to written space that has been zeroed, or it can be mapped to unwritten extents. This program trips over that last condition on XFS. If the file is located on a data device with a raid stripe geometry or on a realtime device with a realtime extent size larger than 1 filesystem block, it's possible for unwritten areas to be backed by unwritten preallocations or unwritten rt blocks, respectively. Fix the test to skip unwritten extents here. Signed-off-by: Darrick J. Wong --- src/fiemap-tester.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/fiemap-tester.c b/src/fiemap-tester.c index 3db24daa79..7e9f9fe8c1 100644 --- a/src/fiemap-tester.c +++ b/src/fiemap-tester.c @@ -375,6 +375,13 @@ check_hole(struct fiemap *fiemap, int fd, __u64 logical_offset, int blocksize) if (logical_offset + blocksize < start) break; + /* + * Filesystems are allowed to fill in holes with preallocated + * unwritten extents + */ + if (extent->fe_flags & FIEMAP_EXTENT_UNWRITTEN) + continue; + if (logical_offset >= start && logical_offset < end) { From patchwork Tue May 2 20:08:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13229261 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 215E6C7EE21 for ; Tue, 2 May 2023 20:08:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229798AbjEBUIw (ORCPT ); Tue, 2 May 2023 16:08:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229820AbjEBUIu (ORCPT ); Tue, 2 May 2023 16:08:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D92461BC1; Tue, 2 May 2023 13:08:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5FB3F60ACD; Tue, 2 May 2023 20:08:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6D05C433EF; Tue, 2 May 2023 20:08:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683058120; bh=Ewcx81n3II88DZyyYEa/0YN50pn3fUFZrWWgSuQlWnE=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=XoDWQ7JeTGfms8y4eZUiIcqa55F2QynZbYXx98XUwuJgbDCtmoyque01na0Upz7/P D/sHGQKOiZtTCPO3Bs3bu81JE85Om6yYssv+p14m+xkCLpQ3O9mot7RC6IGkbKS1X+ 0XViLsXI9Xl+bz/aqa8qLR+09acjJGISqrayWwmWuof9Y1oTLS2wcD1KOjKFqiMLpp eafgn3eDKznf4z+VJey2d01DSLC+POi1CwTzFvTsEaV4RJGG95nRyvA7tq/0ZD9HO7 6v70BQO8rH9ngp9veXxVJylynOz1QDZzUQtUIjvBPVCO4ryBQoNMfkwl669Zp0xlz0 MsSWCT/F0IBwA== Subject: [PATCH 6/7] fiemap: FIEMAP_EXTENT_LAST denotes the last record in the recordset From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Tue, 02 May 2023 13:08:40 -0700 Message-ID: <168305812033.331137.5860693859612500212.stgit@frogsfrogsfrogs> In-Reply-To: <168305808594.331137.16455277063177572891.stgit@frogsfrogsfrogs> References: <168305808594.331137.16455277063177572891.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Remove this check because FIEMAP_EXTENT_LAST denotes the last space mapping record in the recordset of space mappings attached to the file. That last mapping might actually map space beyond EOF, in the case of (a) speculative post-eof preallocations, (b) stripe-aligned allocations on XFS, or (c) realtime files in XFS. Signed-off-by: Darrick J. Wong --- src/fiemap-tester.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/fiemap-tester.c b/src/fiemap-tester.c index 7e9f9fe8c1..fa085a25f1 100644 --- a/src/fiemap-tester.c +++ b/src/fiemap-tester.c @@ -236,7 +236,7 @@ check_flags(struct fiemap *fiemap, int blocksize) static int check_data(struct fiemap *fiemap, __u64 logical_offset, int blocksize, - int last, int prealloc) + int prealloc) { struct fiemap_extent *extent; __u64 orig_offset = logical_offset; @@ -280,11 +280,6 @@ check_data(struct fiemap *fiemap, __u64 logical_offset, int blocksize, if (!found) { printf("ERROR: couldn't find extent at %llu\n", (unsigned long long)(orig_offset / blocksize)); - } else if (last && - !(fiemap->fm_extents[c].fe_flags & FIEMAP_EXTENT_LAST)) { - printf("ERROR: last extent not marked as last: %llu\n", - (unsigned long long)(orig_offset / blocksize)); - found = 0; } return (!found) ? -1 : 0; @@ -418,7 +413,7 @@ compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize, int syncfil { struct fiemap *fiemap; char *fiebuf; - int blocks_to_map, ret, cur_extent = 0, last_data = 0; + int blocks_to_map, ret, cur_extent = 0; __u64 map_start, map_length; int i, c; @@ -437,11 +432,6 @@ compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize, int syncfil map_start = 0; map_length = blocks_to_map * blocksize; - for (i = 0; i < blocks; i++) { - if (map[i] != 'H') - last_data = i; - } - fiemap->fm_flags = syncfile ? FIEMAP_FLAG_SYNC : 0; fiemap->fm_extent_count = blocks_to_map; fiemap->fm_mapped_extents = 0; @@ -471,7 +461,7 @@ compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize, int syncfil switch (map[i]) { case 'D': if (check_data(fiemap, logical_offset, - blocksize, last_data == i, 0)) + blocksize, 0)) goto error; break; case 'H': @@ -481,7 +471,7 @@ compare_fiemap_and_map(int fd, char *map, int blocks, int blocksize, int syncfil break; case 'P': if (check_data(fiemap, logical_offset, - blocksize, last_data == i, 1)) + blocksize, 1)) goto error; break; default: From patchwork Tue May 2 20:08:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13229262 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 807B4C77B78 for ; Tue, 2 May 2023 20:08:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229825AbjEBUIz (ORCPT ); Tue, 2 May 2023 16:08:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229818AbjEBUIy (ORCPT ); Tue, 2 May 2023 16:08:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A4C11996; Tue, 2 May 2023 13:08:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0588862875; Tue, 2 May 2023 20:08:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6253FC433EF; Tue, 2 May 2023 20:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683058126; bh=oVRXWiLdEf14cDzoRaG1mJlFz3704oMb3yF8lHI6iMI=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=aBZVZeRcUOKDn3l1WkwqITFWS7gJiZJN28YV7bFDfF7K1pPJggcXdhzdLnyrVsJ3U bs7nWAd2ovgLInKKzIfH6n5eDQg7lI7Hw9S3FnMZhU/ethNlQAAdlR9RDaJPD1UuUy z8Y9DAr45lcYEZFEI7dUhmeqwZa2iDHo1/CskW0k7/IdjA+YUKcSzX2NIk8ndnto56 1+ovvqUhQJfHFkWE0p6yryNMGmyNmd1r5WMHdTPk7glgLBWqM+lc+EIftO8DgiMA/J rJyaKhaoy13KaN0ST1bYl8V8CiV5o4LLTE8CwI9gxkilKfs6RoSOLaoAIqq2sQd5dM kOAI44q8I6Cjg== Subject: [PATCH 7/7] generic/{094,225}: drop the file allocation unit requirements From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Tue, 02 May 2023 13:08:45 -0700 Message-ID: <168305812593.331137.15186959270369278061.stgit@frogsfrogsfrogs> In-Reply-To: <168305808594.331137.16455277063177572891.stgit@frogsfrogsfrogs> References: <168305808594.331137.16455277063177572891.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Drop these two test precondition requirements now that we've fixed fiemap-tester to handle unwritten preallocations that are mapped to unwritten parts of files and/or mapped beyond EOF. Signed-off-by: Darrick J. Wong --- tests/generic/094 | 5 ----- tests/generic/225 | 5 ----- 2 files changed, 10 deletions(-) diff --git a/tests/generic/094 b/tests/generic/094 index 5c12b7310a..0d9ce8b6ee 100755 --- a/tests/generic/094 +++ b/tests/generic/094 @@ -26,11 +26,6 @@ fiemapfile=$SCRATCH_MNT/$seq.fiemap _require_test_program "fiemap-tester" -# FIEMAP test doesn't like finding unwritten blocks after it punches out -# a partial rt extent. -test "$FSTYP" = "xfs" && \ - _require_file_block_size_equals_fs_block_size $SCRATCH_MNT - seed=`date +%s` echo "using seed $seed" >> $seqres.full diff --git a/tests/generic/225 b/tests/generic/225 index d96382996e..a996889ecf 100755 --- a/tests/generic/225 +++ b/tests/generic/225 @@ -26,11 +26,6 @@ fiemaplog=$SCRATCH_MNT/$seq.log _require_test_program "fiemap-tester" -# FIEMAP test doesn't like finding unwritten blocks after it punches out -# a partial rt extent. -test "$FSTYP" = "xfs" && \ - _require_file_block_size_equals_fs_block_size $SCRATCH_MNT - seed=`date +%s` echo "using seed $seed" >> $fiemaplog