From: Ritesh Harjani <riteshh@linux.ibm.com>
To: fstests <fstests@vger.kernel.org>
Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org,
Ritesh Harjani <riteshh@linux.ibm.com>
Subject: [PATCHv2 4/4] generic/677: Add a test to check unwritten extents tracking
Date: Tue, 15 Mar 2022 19:58:59 +0530 [thread overview]
Message-ID: <37d65f1026f2fc1f2d13ab54980de93f4fa34c46.1647342932.git.riteshh@linux.ibm.com> (raw)
In-Reply-To: <cover.1647342932.git.riteshh@linux.ibm.com>
With these sequence of operation (in certain cases like with ext4 fast_commit)
could miss to track unwritten extents during replay phase
(after sudden FS shutdown).
This fstest adds a test case to test this.
5e4d0eba1ccaf19f
ext4: fix fast commit may miss tracking range for FALLOC_FL_ZERO_RANGE
Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
---
tests/generic/677 | 64 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/677.out | 6 ++++
2 files changed, 70 insertions(+)
create mode 100755 tests/generic/677
create mode 100644 tests/generic/677.out
diff --git a/tests/generic/677 b/tests/generic/677
new file mode 100755
index 00000000..e316763a
--- /dev/null
+++ b/tests/generic/677
@@ -0,0 +1,64 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 IBM Corporation. All Rights Reserved.
+#
+# FS QA Test 677
+#
+# Test below sequence of operation which (w/o below kernel patch) in case of
+# ext4 with fast_commit may misss to track unwritten extents.
+# commit 5e4d0eba1ccaf19f
+# ext4: fix fast commit may miss tracking range for FALLOC_FL_ZERO_RANGE
+#
+. ./common/preamble
+_begin_fstest auto quick log shutdown recoveryloop
+
+# Override the default cleanup function.
+_cleanup()
+{
+ cd /
+ rm -r -f $tmp.*
+}
+
+# Import common functions.
+. ./common/filter
+. ./common/punch
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs generic
+_require_scratch
+_require_xfs_io_command "fzero"
+_require_xfs_io_command "fiemap"
+
+t1=$SCRATCH_MNT/t1
+
+_scratch_mkfs > $seqres.full 2>&1
+
+_scratch_mount >> $seqres.full 2>&1
+
+bs=$(_get_block_size $SCRATCH_MNT)
+
+# create and write data to t1
+$XFS_IO_PROG -f -c "pwrite 0 $((100*$bs))" $t1 | _filter_xfs_io_numbers
+
+# fsync t1
+$XFS_IO_PROG -c "fsync" $t1
+
+# fzero certain range in between
+$XFS_IO_PROG -c "fzero -k $((40*$bs)) $((20*$bs))" $t1
+
+# fsync t1
+$XFS_IO_PROG -c "fsync" $t1
+
+# shutdown FS now for replay of journal to kick during next mount
+_scratch_shutdown -v >> $seqres.full 2>&1
+
+_scratch_cycle_mount
+
+# check fiemap reported is valid or not
+$XFS_IO_PROG -c "fiemap -v" $t1 | _filter_fiemap_flags $bs
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/677.out b/tests/generic/677.out
new file mode 100644
index 00000000..b91ab77a
--- /dev/null
+++ b/tests/generic/677.out
@@ -0,0 +1,6 @@
+QA output created by 677
+wrote XXXX/XXXX bytes at offset XXXX
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+0: [0..39]: none
+1: [40..59]: unwritten
+2: [60..99]: nonelast
--
2.31.1
next prev parent reply other threads:[~2022-03-15 14:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-15 14:28 [PATCHv2 0/4] generic: Add some tests around journal replay/recoveryloop Ritesh Harjani
2022-03-15 14:28 ` [PATCHv2 1/4] generic/468: Add another falloc test entry Ritesh Harjani
2022-03-15 16:51 ` Darrick J. Wong
2022-03-29 10:59 ` Ritesh Harjani
2022-03-15 14:28 ` [PATCHv2 2/4] common/punch: Add block_size argument to _filter_fiemap_** Ritesh Harjani
2022-03-15 14:28 ` [PATCHv2 3/4] generic/676: Add a new shutdown recovery test Ritesh Harjani
2022-03-15 16:55 ` Darrick J. Wong
2022-03-29 11:32 ` Ritesh Harjani
2022-03-31 9:49 ` Ritesh Harjani
2022-03-15 14:28 ` Ritesh Harjani [this message]
2022-03-15 16:56 ` [PATCHv2 4/4] generic/677: Add a test to check unwritten extents tracking Darrick J. Wong
2022-03-29 11:34 ` Ritesh Harjani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=37d65f1026f2fc1f2d13ab54980de93f4fa34c46.1647342932.git.riteshh@linux.ibm.com \
--to=riteshh@linux.ibm.com \
--cc=fstests@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).