From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 62967CFC501 for ; Tue, 15 Oct 2024 02:51:46 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1t0Xez-0001Ey-7b; Tue, 15 Oct 2024 02:51:45 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1t0Xew-0001Ep-Uo for linux-f2fs-devel@lists.sourceforge.net; Tue, 15 Oct 2024 02:51:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; 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:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=pxiCCsuULI1JZG2LQOHaVzXh1g2r8v2g2qYcx6Ge6nM=; b=a/ue2XOyN2CI62bii7Zz5E21Rk Ienv5xeu9ClJRt7KjmkUkS9j00b0ezsNup63pOKi4JpgalQjmrkp4ThxIf2ySkY2kA0qsgcBA/URp Z/rxL8uy9nryFZV1WQHYoLw6Bm1YtIddEF8/g/1mAFfnAym6h9g0manQ9hNp1jFULM4s=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; 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:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=pxiCCsuULI1JZG2LQOHaVzXh1g2r8v2g2qYcx6Ge6nM=; b=Cy+nZrOV1jJSs4yW5h/dQ+t4tA zCLb8ztm1DpnOh9Ge97IeOYOXJr2gpeYmjezN00ZrJ66X/iPMkTeE1X1JvyeSi8Jqt47B1M0Zs7+Y +4aSDQBVrUKNi72b7KzSNuibbLQF4oyeecxaDtZdNAIxjzBj7VTHTsjNUJxonFv1vLyQ=; Received: from nyc.source.kernel.org ([147.75.193.91]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1t0Xew-0005Xs-TM for linux-f2fs-devel@lists.sourceforge.net; Tue, 15 Oct 2024 02:51:43 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 50A1FA401F9; Tue, 15 Oct 2024 02:51:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F8F1C4CED0; Tue, 15 Oct 2024 02:51:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728960691; bh=Y05EfT0ASAjNhTImYRlNb+wZ7uQbgocCROAhY9S4ZAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KWKKJK7vFQn9sRsbVTHVJFDV0KhaqMyDA65XyYsIdE6xEcXx7KE3wklyotJ7CET06 6bIvhp+iaxew4tV+3FuQnvzI2Cz82mURHKCzMd2su6As/Davr92etlVH8Xe9uLxCjG 6lhQ+Ts+YgrJmNCUhLj/8lgcZJR8p7ShTrnXW0VqRTQRrLlNN0BOPhGzGQV1Dt3km1 aS8BfKruyBeHgn8c0JDh/3YJY7T/QLWs8r3kgice8P/2ImNvHZLDr4IuWgB5V8PTey jhomZNcd/L+UrZWWjPGOxrkDdyRAKrNi+q3HpurZl6wM3p50ASaWu12Ud/75XG+KW5 ++/itwbhoM0Mg== To: Zorro Lang Date: Tue, 15 Oct 2024 10:51:06 +0800 Message-Id: <20241015025106.3203676-2-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20241015025106.3203676-1-chao@kernel.org> References: <20241015025106.3203676-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1t0Xew-0005Xs-TM Subject: [f2fs-dev] [PATCH 2/2] f2fs/007: add testcase to check consistency of compressed inode metadata X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Chao Yu via Linux-f2fs-devel Reply-To: Chao Yu Cc: Jaegeuk Kim , Qi Han , fstests@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net metadata of compressed inode should always be consistent after file compression, reservation, releasement and decompression, let's add a testcase to check it. Cc: Jaegeuk Kim Cc: Qi Han Signed-off-by: Chao Yu --- tests/f2fs/007 | 116 +++++++++++++++++++++++++++++++++++++++++++++ tests/f2fs/007.out | 4 ++ 2 files changed, 120 insertions(+) create mode 100755 tests/f2fs/007 create mode 100644 tests/f2fs/007.out diff --git a/tests/f2fs/007 b/tests/f2fs/007 new file mode 100755 index 00000000..274be806 --- /dev/null +++ b/tests/f2fs/007 @@ -0,0 +1,116 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Oppo. All Rights Reserved. +# +# FS QA Test No. f2fs/007 +# +# This is a regression test to check whether compressed metadata +# can become inconsistent after file compression, reservation +# releasement, and decompression. +# +. ./common/preamble +_begin_fstest auto quick + +_cleanup() +{ + cd / + rm -r -f tmp.* +} + +testfile_prefix=$SCRATCH_MNT/testfile +fio_config=$tmp.fio + +cat >$fio_config <> $seqres.full +_scratch_mount "-o compress_mode=user,compress_extension=*" >> $seqres.full + +echo -e "Run fio to initialize file w/ specified compress ratio" >> $seqres.full +cat $fio_config >> $seqres.full +$FIO_PROG $fio_config >> $seqres.full +_scratch_unmount + +for i in 30 60 90; do + testfile=$testfile_prefix$i + + _scratch_mount "-o compress_mode=user" >> $seqres.full + f2fs_io compress $testfile >> $seqres.full + cblocks=`f2fs_io get_cblocks $testfile` + echo "compression ratio is: "$cblocks" / 256" + + _scratch_unmount + + # 1. check after compression + fsck -t $FSTYP -f $SCRATCH_DEV >> $seqres.full + if [ $? -ne 0 ]; then + _fail "filesystem becomes corrupted after compress" + fi + + _scratch_mount >> $seqres.full + f2fs_io release_cblocks $testfile >> $seqres.full + _scratch_unmount + + # 2. check after releasement + fsck -t $FSTYP -f $SCRATCH_DEV >> $seqres.full + if [ $? -ne 0 ]; then + _fail "filesystem becomes corrupted after release_cblocks" + fi + + _scratch_mount >> $seqres.full + f2fs_io reserve_cblocks $testfile >> $seqres.full + _scratch_unmount + + # 3. check after rservation + fsck -t $FSTYP -f $SCRATCH_DEV >> $seqres.full + if [ $? -ne 0 ]; then + _fail "filesystem becomes corrupted after reserve_cblocks" + fi + + _scratch_mount "-o compress_mode=user" >> $seqres.full + f2fs_io decompress $testfile >> $seqres.full + _scratch_unmount + + # 4. check after decompression + fsck -t $FSTYP -f $SCRATCH_DEV >> $seqres.full + if [ $? -ne 0 ]; then + _fail "filesystem becomes corrupted after decompress" + fi +done + +status=0 +exit diff --git a/tests/f2fs/007.out b/tests/f2fs/007.out new file mode 100644 index 00000000..2ea71c18 --- /dev/null +++ b/tests/f2fs/007.out @@ -0,0 +1,4 @@ +QA output created by 007 +compression ratio is: 64 / 256 +compression ratio is: 128 / 256 +compression ratio is: 192 / 256 -- 2.40.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel