From patchwork Mon Dec 15 23:03:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dushan Tcholich X-Patchwork-Id: 5497711 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 14BA3BEEA8 for ; Mon, 15 Dec 2014 21:03:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1685E209F5 for ; Mon, 15 Dec 2014 21:03:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F383C209EB for ; Mon, 15 Dec 2014 21:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750836AbaLOVDI (ORCPT ); Mon, 15 Dec 2014 16:03:08 -0500 Received: from mail-wi0-f175.google.com ([209.85.212.175]:43054 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750738AbaLOVDI (ORCPT ); Mon, 15 Dec 2014 16:03:08 -0500 Received: by mail-wi0-f175.google.com with SMTP id l15so10225833wiw.14 for ; Mon, 15 Dec 2014 13:03:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:user-agent:mime-version :content-type; bh=7/rz2eykGdg21Dbyg5ozxlSo/lgxdc7UmJ3kCaFLWp4=; b=dNhPhwhnB4FOS735SOK8kNwqhKALk4EN5n+bChLrB511L2msB9XlOHUUrWWeCvBlAq XDUhblrU79KY5aAHtM0VMUfIHr5ha12ePB8omZ/wPrz6RLMrDPNqq6EU3B8pu3+Mk6Hj e2kmJGexyrwDMGqltFAXre0MWwjLbxdLDG7NC9TrDUuSAOLJieEUymf8Xn9rzglIqyDl IKWxzDxFdwtq03Un5huwYuI9xMFrEqAlBLzffGxaxqcBWmOr+7I33A4eybQpapM5Bk2K NdNFwSHuCP2vonBfjgMtggtAptOWAIQsj1cP9wciiNYBZ3hY7kP9T+93+i3/vHREGwXu qMXA== X-Received: by 10.194.188.39 with SMTP id fx7mr53506604wjc.113.1418677385940; Mon, 15 Dec 2014 13:03:05 -0800 (PST) Received: from [192.168.0.2] (178-222-112-234.dynamic.isp.telekom.rs. [178.222.112.234]) by mx.google.com with ESMTPSA id gf6sm14412431wjc.11.2014.12.15.13.03.05 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Mon, 15 Dec 2014 13:03:05 -0800 (PST) Date: Tue, 16 Dec 2014 00:03:35 +0100 (CET) From: Dushan Tcholich X-X-Sender: root@reiser4.gekom To: fstests@vger.kernel.org Subject: [PATCH] Check O_DIRECT support before testing direct I/O Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In december 2013 Juhno Ryu posted a patch xfstests: check O_DIRECT support before testing direct I/O to xfs@oss.sgi.com http://oss.sgi.com/archives/xfs/2013-12/msg00759.html As there are no archives of fstests m-l I couldn't find why his patches weren't applied so apologise if this is innapropriate but I rebased his patch upon current xfstests code: --- Some filesystems do not support O_DIRECT. Check whether TEST_DIR supports it by running xfs_io with and without -d flag. Signed-off-by: Junho Ryu Signed-off-by: Dushan Tcholich --- -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- xfstests.orig/common/rc 2014-12-14 15:17:59.000000000 +0100 +++ xfstests/common/rc 2014-12-15 19:40:36.000000000 +0100 @@ -1391,6 +1395,7 @@ AIO_TEST=src/aio-dio-regress/$1 [ -x $AIO_TEST ] || _notrun "$AIO_TEST not built" fi + _require_odirect } # run an aio-dio program @@ -1519,6 +1524,20 @@ _notrun "xfs_io $command failed (old kernel/wrong fs?)" } +# check that kernel and filesystem support direct I/O +_require_odirect() +{ + testfile=$TEST_DIR/$$.direct + $XFS_IO_PROG -F -f -c "pwrite 0 20k" $testfile 2>&1 + if [ $? -eq 0 ]; then + $XFS_IO_PROG -F -f -d -c "pwrite 0 20k" $testfile 2>&1 + if [ $? -ne 0 ]; then + _notrun "O_DIRECT is not supported" + fi + fi + rm -f $testfile 2>&1 > /dev/null +} + # Check that a fs has enough free space (in 1024b blocks) # _require_fs_space() diff -urN xfstests.orig/tests/generic/091 xfstests/tests/generic/091 --- xfstests.orig/tests/generic/091 2014-12-14 15:18:00.000000000 +0100 +++ xfstests/tests/generic/091 2014-12-14 13:25:10.000000000 +0100 @@ -39,6 +39,7 @@ _supported_fs generic _supported_os Linux _require_test +_require_odirect rm -f $seqres.full diff -urN xfstests.orig/tests/generic/130 xfstests/tests/generic/130 --- xfstests.orig/tests/generic/130 2014-12-14 15:18:00.000000000 +0100 +++ xfstests/tests/generic/130 2014-12-14 13:24:50.000000000 +0100 @@ -50,6 +50,7 @@ _require_scratch _require_sparse_files +_require_odirect _scratch_mkfs >/dev/null 2>&1 _scratch_mount diff -urN xfstests.orig/tests/generic/133 xfstests/tests/generic/133 --- xfstests.orig/tests/generic/133 2014-12-14 15:18:00.000000000 +0100 +++ xfstests/tests/generic/133 2014-12-14 13:25:43.000000000 +0100 @@ -39,6 +39,7 @@ _supported_fs generic _supported_os Linux IRIX _require_test +_require_odirect echo "Buffered writer, buffered reader" $XFS_IO_PROG -f -d -c 'pwrite -b 64k 0 512m' $TEST_DIR/io_test > /dev/null diff -urN xfstests.orig/tests/generic/135 xfstests/tests/generic/135 --- xfstests.orig/tests/generic/135 2014-12-14 15:18:00.000000000 +0100 +++ xfstests/tests/generic/135 2014-12-14 13:22:52.000000000 +0100 @@ -39,6 +39,7 @@ _supported_fs generic _supported_os Linux IRIX +_require_odirect _require_scratch _scratch_mkfs >/dev/null 2>&1 diff -urN xfstests.orig/tests/generic/226 xfstests/tests/generic/226 --- xfstests.orig/tests/generic/226 2014-12-14 15:18:00.000000000 +0100 +++ xfstests/tests/generic/226 2014-12-14 13:22:52.000000000 +0100 @@ -37,6 +37,7 @@ _supported_fs generic _supported_os Linux IRIX _require_scratch +_require_odirect # real QA test starts here rm -f $seqres.full diff -urN xfstests.orig/tests/generic/263 xfstests/tests/generic/263 --- xfstests.orig/tests/generic/263 2014-12-14 15:18:00.000000000 +0100 +++ xfstests/tests/generic/263 2014-12-14 13:26:23.000000000 +0100 @@ -39,6 +39,7 @@ _supported_fs generic _supported_os Linux _require_test +_require_odirect rm -f $seqres.full diff -urN xfstests.orig/tests/generic/299 xfstests/tests/generic/299 --- xfstests.orig/tests/generic/299 2014-12-14 15:18:00.000000000 +0100 +++ xfstests/tests/generic/299 2014-12-14 13:22:52.000000000 +0100 @@ -43,6 +43,7 @@ _supported_os Linux _need_to_be_root _require_scratch +_require_odirect NUM_JOBS=$((4*LOAD_FACTOR)) BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV` diff -urN xfstests.orig/tests/generic/300 xfstests/tests/generic/300 --- xfstests.orig/tests/generic/300 2014-12-14 15:18:00.000000000 +0100 +++ xfstests/tests/generic/300 2014-12-14 13:22:52.000000000 +0100 @@ -43,6 +43,7 @@ _supported_os Linux _need_to_be_root _require_scratch +_require_odirect # xfs_io is not required for this test, but it's the best way to verify # the test system supports fallocate() for allocation and hole punching