From patchwork Tue Mar 13 01:56:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10277719 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 BA712603B5 for ; Tue, 13 Mar 2018 01:56:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BAAB28EE1 for ; Tue, 13 Mar 2018 01:56:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 903B328EE5; Tue, 13 Mar 2018 01:56:48 +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 3374A28EE1 for ; Tue, 13 Mar 2018 01:56:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932445AbeCMB4o (ORCPT ); Mon, 12 Mar 2018 21:56:44 -0400 Received: from prv3-mh.provo.novell.com ([137.65.250.26]:39101 "EHLO prv3-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932435AbeCMB4n (ORCPT ); Mon, 12 Mar 2018 21:56:43 -0400 Received: from adam-pc.lan (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Mon, 12 Mar 2018 19:56:28 -0600 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz Subject: [PATCH v2 7/7] btrfs-progs: test/mkfs: Add test case for rootdir inline extent size Date: Tue, 13 Mar 2018 09:56:16 +0800 Message-Id: <20180313015616.6574-8-wqu@suse.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313015616.6574-1-wqu@suse.com> References: <20180313015616.6574-1-wqu@suse.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 a test case for mkfs --rootdir, using files with different file sizes to check if invalid large inline extent could exist. Signed-off-by: Qu Wenruo --- tests/mkfs-tests/014-rootdir-inline-extent/test.sh | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 tests/mkfs-tests/014-rootdir-inline-extent/test.sh diff --git a/tests/mkfs-tests/014-rootdir-inline-extent/test.sh b/tests/mkfs-tests/014-rootdir-inline-extent/test.sh new file mode 100755 index 000000000000..e0765b0bc4e2 --- /dev/null +++ b/tests/mkfs-tests/014-rootdir-inline-extent/test.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# Regression test for mkfs.btrfs --rootdir with inline file extents +# For any large inline file extent, btrfs check could already report it + +source "$TOP/tests/common" + +check_global_prereq fallocate +check_prereq mkfs.btrfs + +prepare_test_dev + +tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX) + +pagesize=$(getconf PAGESIZE) +create_file() +{ + local size=$1 + # Reuse size and filename + run_check fallocate -l $size "$tmp/$size" +} + +test_mkfs_rootdir() +{ + nodesize=$1 + run_check "$TOP/mkfs.btrfs" --nodesize $nodesize -f --rootdir "$tmp" \ + "$TEST_DEV" + run_check $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV" +} + +# File sizes is designed to cross differnet node size, so even +# the sectorsize is not 4K, we can still test it well. +create_file 512 +create_file 1024 +create_file 2048 + +create_file 3994 +create_file 3995 # For 4K node size, max inline would be 4k - 101 +create_file 3996 + +create_file 4095 +create_file 4096 +create_file 4097 + +create_file 8090 +create_file 8091 +create_file 8092 + +create_file 8191 +create_file 8192 +create_file 8193 + +create_file 16282 +create_file 16283 +create_file 16284 + +create_file 16383 +create_file 16384 +create_file 16385 + +create_file 32666 +create_file 32667 +create_file 32668 + +create_file 32767 +create_file 32768 +create_file 32769 + +create_file 65434 +create_file 65435 +create_file 65436 + +create_file 65535 +create_file 65536 +create_file 65537 + +for nodesize in 4096 8192 16384 32768 65536; do + if [ $nodesize -ge $pagesize ]; then + test_mkfs_rootdir $nodesize + fi +done +rm -rf -- "$tmp"