From patchwork Fri Feb 15 12:41:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10814899 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1268413B5 for ; Fri, 15 Feb 2019 12:41:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F34E42F1FF for ; Fri, 15 Feb 2019 12:41:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E5CB72F1FC; Fri, 15 Feb 2019 12:41:47 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 DB4702F1ED for ; Fri, 15 Feb 2019 12:41:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387872AbfBOMlq (ORCPT ); Fri, 15 Feb 2019 07:41:46 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:45630 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728436AbfBOMlq (ORCPT ); Fri, 15 Feb 2019 07:41:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YMwRgbhgm7KO25DT1ZmwIfG0lM5oA4Hy2T1X+FdK0hw=; b=bIrl/gVGHCLuw0kIL6d27I+5b nyAuo+1GLrTA5uuvUeJtFDJrNsS+AawZXgtBpnCd1lKIgUrtTM7Z9q4AvQes8Jv1IJSwPYSt0+OCz gn+S3PfRhYv6K5kN1RlMbciOahQC+WH+QmBzSUiUK2gNlmm+iGyypeZLU1kMIhGPqxwyiAU9obFZM 472FgMbCqKTpQT8Upu8p/hQbE5leOXSOdVjCj4D/GAJfWWmfngLISM9zLrVXTDSX2EdAB/QX2LWol CUoZYdbjU5LpqoASIt0ugsphRr4xWhgbBgKrDKfB6NVEDeCwyUzlzVHfjBO3lKD8P+N8bC53h9JQD 19zcmuTRQ==; Received: from clnet-p01-149.ikbnet.co.at ([83.175.85.149] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gucoK-0002CZ-5H for fstests@vger.kernel.org; Fri, 15 Feb 2019 12:41:45 +0000 From: Christoph Hellwig To: fstests@vger.kernel.org Subject: [PATCH v2] generic: detect preallocation support for fsx tests 075 and 112 Date: Fri, 15 Feb 2019 13:41:40 +0100 Message-Id: <20190215124140.6832-1-hch@lst.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently generic/075 and generic/112 have two extra fsx passes each that exercise fsx with preallocation, which are only enabled for XFS. These tests can also be run with other file systems, given that the XFS prealloc ioctls are implemented in generic code since the addition of the fallocate system call. This also means a version of XFS that does not support preallocation (e.g. because it always writes out of place) can skip the prealloc tests while still completing the normal fsx tests just fine. Signed-off-by: Christoph Hellwig --- Changes since v1: - use the resvsp command instead of falloc - just check for a non-empty output from xfs_io tests/generic/075 | 13 ++++++++----- tests/generic/112 | 17 ++++++++++------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/tests/generic/075 b/tests/generic/075 index 2b957891..acaa3b4c 100755 --- a/tests/generic/075 +++ b/tests/generic/075 @@ -48,11 +48,9 @@ _do_test() echo "fsx.$_n : $_filter_param" echo "-----------------------------------------------" - if [ "$FSTYP" != "xfs" ] - then - if [ "$_n" = "1" -o "$_n" = "3" ] - then - # HACK: only xfs handles preallocation (-x) so just skip this test + # Skip the prealloc runs if the file system does not support preallocation + if [ "$_n" = "1" -o "$_n" = "3" ]; then + if [ -n "$testio" ]; then return fi fi @@ -128,6 +126,11 @@ echo "brevity is wit..." _check_test_fs +# check if preallocation is supported +testfile=$TEST_DIR/$$.xfs_io +testio=`$XFS_IO_PROG -F -f -c "resvsp 0 1" $testfile 2>&1` +rm -f $testfile 2>&1 > /dev/null + # Options: # -d: debug output for all operations # -l flen: the upper bound on file size (default 262144) diff --git a/tests/generic/112 b/tests/generic/112 index 1879e7b5..2c0d53e3 100755 --- a/tests/generic/112 +++ b/tests/generic/112 @@ -48,13 +48,11 @@ _do_test() echo "fsx.$_n : $_filter_param" echo "-----------------------------------------------" - if [ "$FSTYP" != "xfs" ] - then - if [ "$_n" = "1" -o "$_n" = "3" ] - then - # HACK: only xfs handles preallocation (-x) so just skip this test - return - fi + # Skip the prealloc runs if the file system does not support preallocation + if [ "$_n" = "1" -o "$_n" = "3" ]; then + if [ -n "$testio" ]; then + return + fi fi # This cd and use of -P gets full debug on $here (not TEST_DEV) @@ -128,6 +126,11 @@ echo "brevity is wit..." _check_test_fs +# check if preallocation is supported +testfile=$TEST_DIR/$$.xfs_io +testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $testfile 2>&1` +rm -f $testfile 2>&1 > /dev/null + # Options: # -d: debug output for all operations # -l flen: the upper bound on file size (default 262144)