From patchwork Sun Nov 5 12:39:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 10042149 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 891416037D for ; Sun, 5 Nov 2017 13:25:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71BC829551 for ; Sun, 5 Nov 2017 13:25:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 668C42957D; Sun, 5 Nov 2017 13:25:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,LOTS_OF_MONEY, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD9F62958F for ; Sun, 5 Nov 2017 13:25:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751854AbdKENZj (ORCPT ); Sun, 5 Nov 2017 08:25:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:39040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751488AbdKENZi (ORCPT ); Sun, 5 Nov 2017 08:25:38 -0500 Received: from localhost.localdomain (unknown [180.111.132.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6545F218C9; Sun, 5 Nov 2017 13:25:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6545F218C9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=chao@kernel.org From: Chao Yu To: fstests@vger.kernel.org, eguan@redhat.com Cc: jaegeuk@kernel.org, chao@kernel.org, Chao Yu Subject: [PATCH] generic/392: support to test fallocate Date: Sun, 5 Nov 2017 20:39:35 +0800 Message-Id: <20171105123935.14702-1-chao@kernel.org> X-Mailer: git-send-email 2.14.1.145.gb3622a4ee Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Chao Yu f2fs can skip isize updating in fsync(), since during mount, f2fs tries to recovery isize according to valid block address or preallocated flag in last fsynced dnode block. However, fallocate() breaks our rule with setting FALLOC_FL_KEEP_SIZE flag, since it can preallocated block cross EOF, once the file is fsynced, in POR, we will recover isize incorrectly based on these fallocated blocks. This patch enables generic/392 to test fallocate case, in order to verify whether filesystem will do incorrect recovery on isize. Signed-off-by: Chao Yu --- tests/generic/392 | 14 ++++++++++++++ tests/generic/392.out | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/tests/generic/392 b/tests/generic/392 index 6922f7d2..f4ebeb2f 100755 --- a/tests/generic/392 +++ b/tests/generic/392 @@ -125,12 +125,26 @@ test_punch() check_inode_metadata $1 } +test_falloc() +{ + echo "==== falloc $2 test with $1 ====" | tee -a $seqres.full + $XFS_IO_PROG -f -c "truncate 4202496" \ + -c "pwrite 0 4202496" \ + -c "fsync" \ + -c "falloc -k 4202496 $2"\ + $testfile >/dev/null + check_inode_metadata $1 +} + for i in fsync fdatasync; do test_i_size $i 1024 test_i_size $i 4096 test_i_time $i test_punch $i 1024 test_punch $i 4096 + test_falloc $i 1024 + test_falloc $i 4096 + test_falloc $i 104857600 done exit diff --git a/tests/generic/392.out b/tests/generic/392.out index 5d3330a6..d278bdf9 100644 --- a/tests/generic/392.out +++ b/tests/generic/392.out @@ -4,8 +4,14 @@ QA output created by 392 ==== i_time test with fsync ==== ==== fpunch 1024 test with fsync ==== ==== fpunch 4096 test with fsync ==== +==== falloc 1024 test with fsync ==== +==== falloc 4096 test with fsync ==== +==== falloc 104857600 test with fsync ==== ==== i_size 1024 test with fdatasync ==== ==== i_size 4096 test with fdatasync ==== ==== i_time test with fdatasync ==== ==== fpunch 1024 test with fdatasync ==== ==== fpunch 4096 test with fdatasync ==== +==== falloc 1024 test with fdatasync ==== +==== falloc 4096 test with fdatasync ==== +==== falloc 104857600 test with fdatasync ====