From patchwork Fri Jun 16 01:43:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 9790443 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 3F6DE6038F for ; Fri, 16 Jun 2017 01:43:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3209627F86 for ; Fri, 16 Jun 2017 01:43:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 257472862C; Fri, 16 Jun 2017 01:43:59 +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,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 602F028614 for ; Fri, 16 Jun 2017 01:43:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751829AbdFPBnn (ORCPT ); Thu, 15 Jun 2017 21:43:43 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:8454 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751739AbdFPBnm (ORCPT ); Thu, 15 Jun 2017 21:43:42 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="20097161" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 16 Jun 2017 09:43:39 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 03D7B47C7C61; Fri, 16 Jun 2017 09:43:37 +0800 (CST) Received: from localhost.localdomain (10.167.226.34) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 16 Jun 2017 09:43:34 +0800 From: Qu Wenruo To: CC: Subject: [PATCH 2/2] btrfs-progs: Add test case to check hole file extents with NO_HOLES flag Date: Fri, 16 Jun 2017 09:43:23 +0800 Message-ID: <20170616014323.13170-2-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170616014323.13170-1-quwenruo@cn.fujitsu.com> References: <20170616014323.13170-1-quwenruo@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.34] X-yoursite-MailScanner-ID: 03D7B47C7C61.AD3CA X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: quwenruo@cn.fujitsu.com Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add test case which we have NO_HOLES incompat flag while still have hole file extent. This can be created by enabling NO_HOLES feature on an existing filesystem, which lowmem mode would cause false alert for it. Signed-off-by: Qu Wenruo --- tests/fsck-tests/025-file-extents/test.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/fsck-tests/025-file-extents/test.sh b/tests/fsck-tests/025-file-extents/test.sh index e4bc4247..66cfbaab 100755 --- a/tests/fsck-tests/025-file-extents/test.sh +++ b/tests/fsck-tests/025-file-extents/test.sh @@ -5,6 +5,7 @@ source "$TOP/tests/common" check_prereq btrfs check_prereq mkfs.btrfs +check_prereq btrfstune check_global_prereq dd check_global_prereq fallocate @@ -38,5 +39,21 @@ test_compressed_inline_extent() run_check "$TOP/btrfs" check "$TEST_DEV" } +# Hole file extent with NO_HOLES incompat flag +# Lowmem mode will cause false alert as it doesn't allow any hole file extent +# exist, while we can set NO_HOLES at anytime we want, it's definitely a false +# alert +test_hole_extent_with_no_holes_flag() +{ + run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_DEV" + run_check_mount_test_dev + + run_check $SUDO_HELPER truncate -s 16K "$TEST_MNT/tmp" + run_check_umount_test_dev + run_check $SUDO_HELPER "$TOP/btrfstune" -n "$TEST_DEV" + run_check "$TOP/btrfs" check "$TEST_DEV" +} + test_paritical_write_into_prealloc test_compressed_inline_extent +test_hole_extent_with_no_holes_flag