From patchwork Tue Mar 12 16:42:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 227082 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 D7EF42C0299 for ; Wed, 13 Mar 2013 03:42:55 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932392Ab3CLQmx (ORCPT ); Tue, 12 Mar 2013 12:42:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60606 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932065Ab3CLQmw (ORCPT ); Tue, 12 Mar 2013 12:42:52 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2CGgpB2010219 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 12 Mar 2013 12:42:51 -0400 Received: from liberator.sandeen.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r2CGgnGg025899 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 Mar 2013 12:42:50 -0400 Message-ID: <513F5B0A.4030405@redhat.com> Date: Tue, 12 Mar 2013 11:42:50 -0500 From: Eric Sandeen User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130216 Thunderbird/17.0.3 MIME-Version: 1.0 To: xfs-oss , ext4 development , linux-btrfs Subject: [PATCH] xfstests: make defrag test 222 generic X-Enigmail-Version: 1.5.1 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org test 222 is just a stress test defragging the test device: # xfs_fsr QA tests # run xfs_fsr over the test filesystem to give it a wide and varied set of # inodes to try to defragment. This is effectively a crash/assert failure # test looking for corruption induced by xfs_fsr runs. There's no reason we can't do the same for other filesystems. Define a new _defrag_dir() helper which just runs noisy/debug dir defrag for ext4 and/or btrfs as well, and use that in 222 instead of hardcoded xfs_fsr. Make 222 (and 218) generic; if no defrag is supported it just won't run. Change the comments at the top while we're at it. Signed-off-by: Eric Sandeen --- -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/218 b/218 index 77782c6..e337bbf 100755 --- a/218 +++ b/218 @@ -44,7 +44,7 @@ _cleanup() . ./common.defrag # real QA test starts here -_supported_fs xfs ext4 btrfs +_supported_fs generic _supported_os Linux _setup_testdir diff --git a/222 b/222 index df2672f..dc4d621 100755 --- a/222 +++ b/222 @@ -1,10 +1,10 @@ #! /bin/bash # FS QA Test No. 222 # -# xfs_fsr QA tests -# run xfs_fsr over the test filesystem to give it a wide and varied set of +# defrag QA tests +# run defrag over the test filesystem to give it a wide and varied set of # inodes to try to defragment. This is effectively a crash/assert failure -# test looking for corruption induced by xfs_fsr runs. +# test looking for corruption induced by defragmentation runs. # #----------------------------------------------------------------------- # Copyright (c) 2010 Dave Chinner. All Rights Reserved. @@ -44,14 +44,15 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15 # get standard environment, filters and checks . ./common.rc . ./common.filter +. ./common.defrag # real QA test starts here -_supported_fs xfs +_supported_fs generic _supported_os Linux -[ "$XFS_FSR_PROG" = "" ] && _notrun "xfs_fsr not found" +_require_defrag -xfs_fsr -d -v $TEST_DIR > $seq.full 2>&1 +_defrag_dir $TEST_DIR > $seq.full 2>&1 echo "--- silence is golden ---" status=0 ; exit diff --git a/common.defrag b/common.defrag index 9c9eb9b..7736330 100644 --- a/common.defrag +++ b/common.defrag @@ -69,3 +69,19 @@ _defrag() rm -f $1 } +# Defrag a whole directory. No checking as above, just run it, noisily +# output should be sent to $seq.full since it's very fs-specific +_defrag_dir() +{ + case "$FSTYP" in + xfs) + $DEFRAG_PROG -d -v $1 + ;; + ext4|ext4dev|btrfs) + $DEFRAG_PROG -v $1 + ;; + *) + $DEFRAG_PROG $1 + ;; + esac +}