From patchwork Mon Jan 28 07:32:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Liu X-Patchwork-Id: 216119 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 389592C0080 for ; Mon, 28 Jan 2013 18:20:38 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752716Ab3A1HUh (ORCPT ); Mon, 28 Jan 2013 02:20:37 -0500 Received: from mail-pb0-f53.google.com ([209.85.160.53]:65099 "EHLO mail-pb0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751948Ab3A1HUh (ORCPT ); Mon, 28 Jan 2013 02:20:37 -0500 Received: by mail-pb0-f53.google.com with SMTP id un1so1297255pbc.12 for ; Sun, 27 Jan 2013 23:20:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=HeUGESSVj6wWNYyUl9PYmYWUdidcQrSADNTdwiXmCkk=; b=ATXutGHYvoOBCUktgrmMP89YqyYK2ue2t2wFOo6kX6aHqi+gRvXbTyLLvyYY8sZZi6 iTtOvk8binlCca2coix6Db4ssvmI65J9q4yBLemYgqZ4FQ9G9i6TYRS9YMZMFmOL8U0B ITTMCX37WjXbSiV4WGCqP2jMDiV4ZE2DeXgA8sR84NjnD+xEiEm8rUSyKvqOppTotonW vu/aXa4O1Q8gLcivzBaVBsMDnw4B47yftvsNhvl4diJqJShjlDGRprBfBMJqMLsRVXmQ X2EzFjwSNflmQoTL4sBuWRO1e0GBr/gHqcRqbEf4VaDpiCvpsJ/gfe61sspAoeLzHJwt tvnQ== X-Received: by 10.68.219.67 with SMTP id pm3mr35468855pbc.150.1359357637085; Sun, 27 Jan 2013 23:20:37 -0800 (PST) Received: from lz-desktop.taobao.ali.com ([182.92.247.2]) by mx.google.com with ESMTPS id t6sm6226006paz.11.2013.01.27.23.20.32 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 27 Jan 2013 23:20:36 -0800 (PST) From: Zheng Liu To: xfs@oss.sgi.com, linux-ext4@vger.kernel.org Cc: Zheng Liu , "Theodore Ts'o" , Dave Chinner Subject: [PATCH 3/4] xfstests: check llseek(2) SEEK_DATA/HOLE and unwritten extent preallocation in 285 Date: Mon, 28 Jan 2013 15:32:50 +0800 Message-Id: <1359358371-21411-4-git-send-email-wenqing.lz@taobao.com> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: <1359358371-21411-1-git-send-email-wenqing.lz@taobao.com> References: <1359358371-21411-1-git-send-email-wenqing.lz@taobao.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Zheng Liu In 285 it has its own check for seek data/hole support. This commit turns into an equivalent _require_seek_data_hole. Meanwhile in 285 it doesn't check unwritten extent preallocation. Now ext4 file system has supported seek data/hole for a file w/o unwritten extent. Thus, in 285, it needs to call the _require_xfs_io_falloc to check unwritten extent prealloction. Signed-off-by: Zheng Liu Cc: "Theodore Ts'o" Cc: Dave Chinner --- 285 | 7 +++++-- common.rc | 12 ++++++++++++ src/seek_sanity_test.c | 18 +++++++++++++----- 3 files changed, 30 insertions(+), 7 deletions(-) mode change 100644 => 100755 285 diff --git a/285 b/285 old mode 100644 new mode 100755 index a18fc71..6224673 --- a/285 +++ b/285 @@ -1,7 +1,7 @@ #! /bin/bash # FS QA Test No. 285 # -# SEEK_DATA/SEEK_HOLE sanity tests. +# SEEK_DATA/SEEK_HOLE sanity tests w/ unwritten extent. # # Improved by Jeff.liu@oracle.com # Creater: josef@redhat.com @@ -41,9 +41,12 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fs generic _supported_os Linux +_require_seek_data_hole +_require_xfs_io_falloc + BASE_TEST_FILE=$TEST_DIR/seek_sanity_testfile -[ -x $here/src/seek_sanity_test ] || _notrun "seek_sanitfy_tester not built" +[ -x $here/src/seek_sanity_test ] || _notrun "seek_sanity_tester not built" _cleanup() { diff --git a/common.rc b/common.rc index 2e8581e..35a5f52 100644 --- a/common.rc +++ b/common.rc @@ -1049,6 +1049,18 @@ _require_sparse_files() esac } +# +# Check if the filesystem supports seek_data/hole. +# +_require_seek_data_hole() +{ + testfile=$TEST_DIR/$$.seek + testseek=`$here/src/seek_sanity_test -t $testfile 2>&1` + rm -f $testfile 2>&1 > /dev/null + echo $testseek | grep -q "Kernel does not support" && \ + _notrun "File system does not support llseek(2) SEEK_DATA/HOLE" +} + # check that a FS on a device is mounted # if so, return mount point # diff --git a/src/seek_sanity_test.c b/src/seek_sanity_test.c index 3897f02..b1ef006 100644 --- a/src/seek_sanity_test.c +++ b/src/seek_sanity_test.c @@ -660,17 +660,25 @@ int main(int argc, char **argv) { int ret = -1; int i = 0; + int opt; + int check_support = 0; int numtests = sizeof(seek_tests) / sizeof(struct testrec); - if (argc != 2) { - fprintf(stdout, "Usage: %s base_file_path\n", argv[0]); - return ret; + while ((opt = getopt(argc, argv, "t")) != -1) { + switch (opt) { + case 't': + check_support++; + break; + default: + fprintf(stdout, "Usage: %s [-t] base_file_path\n", argv[0]); + return ret; + } } - base_file_path = (char *)strdup(argv[1]); + base_file_path = (char *)strdup(argv[optind]); ret = test_basic_support(); - if (ret) + if (ret || check_support) goto out; for (i = 0; i < numtests; ++i) {