From patchwork Sat Dec 21 08:23:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13919114 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 A86A1125D6 for ; Mon, 23 Dec 2024 14:34:45 +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=1734964485; cv=none; b=euzXNXvATA3gZ71eyoEZJshwQKqGzdsrQhzzlUXWPbxInxNIr1cb9KjCJ/6o7ECGAAc1I/GXzh8fVwbtZndhdKGXSur19Y34jRgI4pdufzVX0gHjXBP+L0n2buOM7mRIKrwKqthm+sv6xLt14Hw/GJc7Nk8Sze7OTMVuv5WqdNA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734964485; c=relaxed/simple; bh=bo1NMs4/YFWYdMJuYiGmiCfBcLSkozOTWwUXUhPmLa4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=h/Q2BdvgXv+WBL/sjhhdSoyBNrO1BcjI7huRUmssYtqAxwqqp/rYv3Ll2YRyc1Wn475LQVT3Jto5vK62UKSRT5df8+0/324OfAypnCo5wclXMf4fwPCYRBnzFicC9r44uaeMFYXApouzKUey0VVs1jfX3sYBjw26h0DPzTYS1Hw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pIX178mm; 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="pIX178mm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C811AC4CED3; Mon, 23 Dec 2024 14:34:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734964485; bh=bo1NMs4/YFWYdMJuYiGmiCfBcLSkozOTWwUXUhPmLa4=; h=From:To:Cc:Subject:Date:From; b=pIX178mmbdMEG91W9KDTnkDkLeDx/KModlvqyWdQm6CAwBUqn0BYPQYQgYpywH5on jP84xltWDfx6iVKlwt+bdx+/kpjYg/2ieYAsLYtlhVSg94bctrGOIL4oYyAB+FNZre UI7YwYg9UC5qSsGtarGmc+7tTeSM8HClR1w0NVBhnVgKFDY/+crClDlopnAMj/SoTR zHR+Pwh+f6sdUne2f5hPxhG+UrNwEprrchxFaVhXF0mCpUs0CGv5LnRxaROEiN3CDe Lt/9om+stuEJRoG6iYBlNtpn50U1BJQtcTymjnA3gYDxAIdSA8ySPD4InatpcUn1qE lee+hrqyZ6ksw== From: Chao Yu To: Zorro Lang , fstests@vger.kernel.org Cc: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net, Chao Yu Subject: [PATCH v3 1/2] common/rc: support f2fs in _mkfs_dev() Date: Sat, 21 Dec 2024 16:23:44 +0800 Message-Id: <20241221082345.196029-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Then, f2fs/* testcases can use this wrapped common helper instead of raw codes. Suggested-by: Zorro Lang Signed-off-by: Chao Yu --- v3: - adapt _mkfs_dev() to support f2fs, preparing for following use in f2fs/008. common/rc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/rc b/common/rc index 7b5bc0b4..ecac2de8 100644 --- a/common/rc +++ b/common/rc @@ -833,6 +833,9 @@ _try_mkfs_dev() ext2|ext3|ext4) $MKFS_PROG -t $FSTYP -- -F $MKFS_OPTIONS $* ;; + f2fs) + $MKFS_PROG -t $FSTYP -- -f $MKFS_OPTIONS $* + ;; xfs) $MKFS_PROG -t $FSTYP -- -f $MKFS_OPTIONS $* ;; From patchwork Sat Dec 21 08:23:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13919115 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 58448125D6 for ; Mon, 23 Dec 2024 14:34:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734964488; cv=none; b=LjJzHggGdGgfINZzW5yWJDI3pPdC3Z3IAj1ER0zx2MCFbu4nBIpIhr/MGwah7y1GRZXg8A0KrcFAgagRFLg0fzBHzArZfibu2WPPMI/w2j7Wyp6QfKiuxohC/LthKGgvYbbD603YKhwjGXcDjNDWBtKfc4jpv04eY8+tygV6vrE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734964488; c=relaxed/simple; bh=VoExVT7XSETeqfLPoMzHOXZlM95/se/ZF/joAL/Vt28=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jD3fW3CFys7T6V6lVd8mfNI50KhR4zdHBgE5E+HFdSwLTtfHpny8KN9d+7DCRwX4xmYuM5eDi+HpLEOk1CSZ3KrPMfgiVIO97SDvmf2sbridcyAkXNDNLIbxdCC+Pk2Bb47k2PcaQQzXkUeo7qv0b9Zhj1kxkcopEeJnXEvwokM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=S1KYSWAR; 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="S1KYSWAR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B06BDC4CED6; Mon, 23 Dec 2024 14:34:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734964487; bh=VoExVT7XSETeqfLPoMzHOXZlM95/se/ZF/joAL/Vt28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S1KYSWARLYFHMwTOj65ClztiCVzvCWL4Q+ugeAs0BK6ctDb28XWtHErG9rOgJ2wVT Wh5TCfVjIyMrqfHmSXJPApWhA5vQ7ZErYS9C1CyEgHQNjRx7gmRA82GLfeMPcD67nM XyqWg3T4rN/2e5z0K9Lgp8BOZOXW6ENIB3dEHiHl2DPCNTmsx3iTbYmDcwJJLpygSn w1kONiZUU8rc3goNVf0YgumE2Vi3wWoMwDmiawH4dqKQ9if5n4DblaLN47N5zieGH5 3m7z8aE3yjNlUY9y34jlCHFdwXVWpvmdwT9daztsPJWAc1bh+cRgOylc6z4C1G2ar5 O6Gg9s2RPGdhQ== From: Chao Yu To: Zorro Lang , fstests@vger.kernel.org Cc: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net, Chao Yu Subject: [PATCH v3 2/2] f2fs/008: test snapshot creation/deletion on lvm device Date: Sat, 21 Dec 2024 16:23:45 +0800 Message-Id: <20241221082345.196029-2-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20241221082345.196029-1-chao@kernel.org> References: <20241221082345.196029-1-chao@kernel.org> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This patch introduce a regression testcase to check whether f2fs can handle discard correctly once underlying lvm device changes to not support discard after user creates snapshot on it. Related bug was fixed by commit bc8aeb04fd80 ("f2fs: fix to drop all discards after creating snapshot on lvm device") Cc: Jaegeuk Kim Signed-off-by: Chao Yu --- v3: - rebase to last for-next branch - update according to Zorro's comments. tests/f2fs/008 | 57 ++++++++++++++++++++++++++++++++++++++++++++++ tests/f2fs/008.out | 2 ++ 2 files changed, 59 insertions(+) create mode 100755 tests/f2fs/008 create mode 100644 tests/f2fs/008.out diff --git a/tests/f2fs/008 b/tests/f2fs/008 new file mode 100755 index 00000000..b85e321c --- /dev/null +++ b/tests/f2fs/008 @@ -0,0 +1,57 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Oppo. All Rights Reserved. +# +# FS QA Test No. f2fs/008 +# +# This is a regression test to check whether f2fs can handle +# discard correctly once underlying lvm device changes to not +# support discard after user creates snapshot on it. +# + +. ./common/preamble +_begin_fstest auto quick rw + +_fixed_by_kernel_commit bc8aeb04fd80 \ + "f2fs: fix to drop all discards after creating snapshot on lvm device" + +_require_scratch_nolvm +_require_block_device $SCRATCH_DEV +_require_command "$LVM_PROG" lvm + +lvname=lv_$seq +vgname=vg_$seq +testfile=$SCRATCH_MNT/testfile + +_cleanup() +{ + _unmount $SCRATCH_MNT >>$seqres.full 2>&1 + $LVM_PROG lvremove -ff /dev/mapper/$lvname-snapshot $vgname >>$seqres.full 2>&1 + $LVM_PROG lvremove -ff /dev/mapper/$vgname-$lvname >>$seqres.full 2>&1 + $LVM_PROG vgremove -ff $vgname >>$seqres.full 2>&1 + $LVM_PROG pvremove -ff $SCRATCH_DEV >>$seqres.full 2>&1 + _udev_wait --removed /dev/mapper/$vgname-$lvname + cd / + rm -f $tmp.* +} + +$LVM_PROG pvcreate -f $SCRATCH_DEV >>$seqres.full 2>&1 +$LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1 +$LVM_PROG lvcreate -L 1024m -n $lvname $vgname >>$seqres.full 2>&1 +_udev_wait /dev/mapper/$vgname-$lvname + +_mkfs_dev /dev/mapper/$vgname-$lvname >>$seqres.full 2>&1 +_mount -o discard /dev/mapper/$vgname-$lvname $SCRATCH_MNT >>$seqres.full 2>&1 + +dd if=/dev/zero of=$testfile bs=1M count=20 >>$seqres.full 2>&1 +sync +rm -f $testfile +sync + +# create a snapshot on lvm device +$LVM_PROG lvcreate -L 1024m -s -n $lvname-snapshot /dev/mapper/$vgname-$lvname >>$seqres.full 2>&1 + +echo "Silence is golden" + +status=0 +exit diff --git a/tests/f2fs/008.out b/tests/f2fs/008.out new file mode 100644 index 00000000..dd68d5a4 --- /dev/null +++ b/tests/f2fs/008.out @@ -0,0 +1,2 @@ +QA output created by 008 +Silence is golden