From patchwork Tue Oct 15 10:09:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 11189935 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7DF9C112B for ; Tue, 15 Oct 2019 10:10:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5FA8121835 for ; Tue, 15 Oct 2019 10:10:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727859AbfJOKKG (ORCPT ); Tue, 15 Oct 2019 06:10:06 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:37816 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727625AbfJOKKF (ORCPT ); Tue, 15 Oct 2019 06:10:05 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 59D5769221E3251C0F2B; Tue, 15 Oct 2019 18:10:03 +0800 (CST) Received: from szvp000203569.huawei.com (10.120.216.130) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.439.0; Tue, 15 Oct 2019 18:09:57 +0800 From: Chao Yu To: CC: , , "Chao Yu" Subject: [PATCH v2 1/2] common/defrag: support f2fs Date: Tue, 15 Oct 2019 18:09:37 +0800 Message-ID: <20191015100938.123519-1-yuchao0@huawei.com> X-Mailer: git-send-email 2.18.0.rc1 MIME-Version: 1.0 X-Originating-IP: [10.120.216.130] X-CFilter-Loop: Reflected Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org F2FS supports defragment based on file granularity, adjust test suit to support f2fs. Signed-off-by: Chao Yu --- v2: - use local variable in function common/config | 2 ++ common/defrag | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/common/config b/common/config index a0d58bde..22592cec 100644 --- a/common/config +++ b/common/config @@ -176,6 +176,7 @@ export XFS_COPY_PROG="$(type -P xfs_copy)" export FSTRIM_PROG="$(type -P fstrim)" export DUMPE2FS_PROG="$(type -P dumpe2fs)" export RESIZE2FS_PROG="$(type -P resize2fs)" +export F2FS_IO_PROG="$(type -P f2fs_io)" export FIO_PROG="$(type -P fio)" export FILEFRAG_PROG="$(type -P filefrag)" export E4DEFRAG_PROG="$(type -P e4defrag)" @@ -242,6 +243,7 @@ case "$HOSTOS" in export MKFS_BTRFS_PROG=$(set_mkfs_prog_path_with_opts btrfs) export MKFS_F2FS_PROG=$(set_mkfs_prog_path_with_opts f2fs) export DUMP_F2FS_PROG=$(type -P dump.f2fs) + export F2FS_IO_PROG=$(type -P f2fs_io) export BTRFS_UTIL_PROG=$(type -P btrfs) export BTRFS_SHOW_SUPER_PROG=$(type -P btrfs-show-super) export BTRFS_CONVERT_PROG=$(type -P btrfs-convert) diff --git a/common/defrag b/common/defrag index 2bd739c0..1381a4dd 100644 --- a/common/defrag +++ b/common/defrag @@ -27,6 +27,9 @@ _require_defrag() rm -f $testfile $donorfile 2>&1 > /dev/null DEFRAG_PROG="$E4DEFRAG_PROG" ;; + f2fs) + DEFRAG_PROG="$F2FS_IO_PROG defrag_file" + ;; btrfs) DEFRAG_PROG="$BTRFS_UTIL_PROG filesystem defragment" ;; @@ -140,7 +143,13 @@ _defrag() [ ! -z $csum ] && CSUM_BEFORE=`md5sum $1` STAT_BEFORE=`stat -c "a: %x m: %y c: %z" $1` - $DEFRAG_PROG -v $1 >> $seqres.full 2>&1 + + if [ $FSTYP == "f2fs" ]; then + local filesize=`ls -l $1 | $AWK_PROG '{print $5}'` + $DEFRAG_PROG 0 $filesize $1 >> $seqres.full 2>&1 + else + $DEFRAG_PROG -v $1 >> $seqres.full 2>&1 + fi _scratch_cycle_mount STAT_AFTER=`stat -c "a: %x m: %y c: %z" $1` From patchwork Tue Oct 15 10:09:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 11189937 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D6342112B for ; Tue, 15 Oct 2019 10:10:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C09A32089C for ; Tue, 15 Oct 2019 10:10:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727018AbfJOKKK (ORCPT ); Tue, 15 Oct 2019 06:10:10 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3761 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727625AbfJOKKK (ORCPT ); Tue, 15 Oct 2019 06:10:10 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 69A51920D057863A23CD; Tue, 15 Oct 2019 18:10:08 +0800 (CST) Received: from szvp000203569.huawei.com (10.120.216.130) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.439.0; Tue, 15 Oct 2019 18:09:58 +0800 From: Chao Yu To: CC: , , "Chao Yu" Subject: [PATCH v2 2/2] common/casefold: support f2fs Date: Tue, 15 Oct 2019 18:09:38 +0800 Message-ID: <20191015100938.123519-2-yuchao0@huawei.com> X-Mailer: git-send-email 2.18.0.rc1 In-Reply-To: <20191015100938.123519-1-yuchao0@huawei.com> References: <20191015100938.123519-1-yuchao0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.120.216.130] X-CFilter-Loop: Reflected Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org Now, f2fs has ported casefold feature from ext4, let's enable the testcase. Signed-off-by: Chao Yu --- v2: - no changes. common/casefold | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/casefold b/common/casefold index 2a7ab3eb..9172d818 100644 --- a/common/casefold +++ b/common/casefold @@ -9,6 +9,9 @@ _has_casefold_kernel_support() ext4) test -f '/sys/fs/ext4/features/casefold' ;; + f2fs) + test -f '/sys/fs/f2fs/features/casefold' + ;; *) # defaults to unsupported false @@ -46,6 +49,9 @@ _scratch_mkfs_casefold() ext4) _scratch_mkfs -O casefold $* ;; + f2fs) + _scratch_mkfs -C utf8 $* + ;; *) _notrun "Don't know how to mkfs with casefold support on $FSTYP" ;; @@ -58,6 +64,9 @@ _scratch_mkfs_casefold_strict() ext4) _scratch_mkfs -O casefold -E encoding_flags=strict ;; + f2fs) + _scratch_mkfs -C utf8:strict + ;; *) _notrun "Don't know how to mkfs with casefold-strict support on $FSTYP" ;;