From patchwork Mon Nov 30 01:39:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 7719871 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 86EA59F30B for ; Mon, 30 Nov 2015 01:41:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A533B20561 for ; Mon, 30 Nov 2015 01:41:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A7662045B for ; Mon, 30 Nov 2015 01:41:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752193AbbK3Blu (ORCPT ); Sun, 29 Nov 2015 20:41:50 -0500 Received: from cn.fujitsu.com ([59.151.112.132]:39908 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751555AbbK3Blt (ORCPT ); Sun, 29 Nov 2015 20:41:49 -0500 X-IronPort-AV: E=Sophos;i="5.20,346,1444665600"; d="scan'208";a="959850" Received: from unknown (HELO cn.fujitsu.com) ([10.167.250.3]) by heian.cn.fujitsu.com with ESMTP; 30 Nov 2015 09:41:36 +0800 Received: from localhost.localdomain (unknown [10.167.226.34]) by cn.fujitsu.com (Postfix) with ESMTP id 3A5B44043CFB for ; Mon, 30 Nov 2015 09:41:34 +0800 (CST) From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH] btrfs-progs: mkfs-tests: Check sectorsize and nodesize combination Date: Mon, 30 Nov 2015 09:39:30 +0800 Message-Id: <1448847570-9549-1-git-send-email-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.6.2 MIME-Version: 1.0 X-yoursite-MailScanner-Information: Please contact the ISP for more information X-yoursite-MailScanner-ID: 3A5B44043CFB.A0AE6 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: quwenruo@cn.fujitsu.com X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add mkfs selftest for invalid and valid sectorsize/nodesize combination. Signed-off-by: Qu Wenruo --- .../008-secorsize-nodesize-combination/test.sh | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 tests/mkfs-tests/008-secorsize-nodesize-combination/test.sh diff --git a/tests/mkfs-tests/008-secorsize-nodesize-combination/test.sh b/tests/mkfs-tests/008-secorsize-nodesize-combination/test.sh new file mode 100755 index 0000000..5bc3a48 --- /dev/null +++ b/tests/mkfs-tests/008-secorsize-nodesize-combination/test.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# test variant sectorsize and node size combination +# including valid ones and invalid ones +# only do mkfs and fsck check, no mounting check as +# sub/multi-pagesize is not supported yet. + +source $TOP/tests/common + +check_prereq mkfs.btrfs +check_prereq btrfs + +# disable mixed bg to avoid sectorsize == nodesize check +features="^mixed-bg" +image_size=1g +image=image + +# caller need to judge whether the combination is valid +do_test() +{ + sectorsize=$1 + nodesize=$2 + truncate -s $image_size $image + run_mayfail $TOP/mkfs.btrfs -O $features -n $nodesize -s $sectorsize \ + $image + ret=$? + if [ $ret == 0 ]; then + run_check $TOP/btrfs check $image + fi + return $ret +} + +# Invalid: Unaligned sectorsize and nodesize +do_test 8191 8191 && _fail + +# Invalid: Aligned sectorsize with unaligned nodesize +do_test 4k 16385 && _fail + +# Invalid: Ungliend sectorsize with aligned nodesize +do_test 8191 16k && _fail + +# Valid: Aligned sectorsize and nodesize +do_test 4k 16k || _fail + +# Invalid: Sectorsize larger than nodesize +do_test 8k 4k && _fail + +# Invalid: too large nodesize +do_test 16k 128k && _fail + +# Valid: large sectorsize +do_test 64k 64k || _fail