From owner-svn-src-projects@FreeBSD.ORG Sun Jan 30 12:12:25 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8820C1065673; Sun, 30 Jan 2011 12:12:25 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 77BA18FC15; Sun, 30 Jan 2011 12:12:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0UCCPFv071082; Sun, 30 Jan 2011 12:12:25 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0UCCPGs071077; Sun, 30 Jan 2011 12:12:25 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201101301212.p0UCCPGs071077@svn.freebsd.org> From: Peter Holm Date: Sun, 30 Jan 2011 12:12:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218087 - projects/stress2/misc X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 12:12:25 -0000 Author: pho Date: Sun Jan 30 12:12:25 2011 New Revision: 218087 URL: http://svn.freebsd.org/changeset/base/218087 Log: Added test scenarios for the newfs(8) option TRIM. Added: projects/stress2/misc/trim.sh (contents, props changed) projects/stress2/misc/trim2.sh (contents, props changed) projects/stress2/misc/trim3.sh (contents, props changed) projects/stress2/misc/trim4.sh (contents, props changed) Added: projects/stress2/misc/trim.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/stress2/misc/trim.sh Sun Jan 30 12:12:25 2011 (r218087) @@ -0,0 +1,76 @@ +#!/bin/sh + +# +# Copyright (c) 2011 Peter Holm +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +# Run with marcus.cfg on a malloc backed MD with option trim. + +. ../default.cfg + +[ "`sysctl vm.md_malloc_wait | awk '{print $NF}'`" != "1" ] && \ + echo "sysctl vm.md_malloc_wait should be set to 1" +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart + +size="128m" +[ `uname -m` = "amd64" ] && size="1g" +[ $# -eq 0 ] && trim=-t +n=0 +for flag in '' '-U' '-U'; do + n=$((n + 1)) + echo "mdconfig -a -t malloc -o reserve -s $size -u $mdstart" + mdconfig -a -t malloc -o reserve -s $size -u $mdstart || exit 1 + bsdlabel -w md$mdstart auto + + echo "newfs $trim $flag md${mdstart}$part" + newfs $trim $flag md${mdstart}$part > /dev/null + [ $n -eq 3 ] && tunefs -? 2>&1 | grep -q "j enable" && \ + tunefs -j enable /dev/md${mdstart}$part + + mount /dev/md${mdstart}$part $mntpoint + chmod 777 $mntpoint + + export runRUNTIME=10m + export RUNDIR=$mntpoint/stressX + + su $testuser -c 'cd ..; ./run.sh marcus.cfg' > /dev/null 2>&1 + + while mount | grep $mntpoint | grep -q /dev/md; do + umount $mntpoint || sleep 1 + done + dumpfs /dev/md${mdstart}$part > /tmp/dumpfs.1 + sleep 1 + fsck -t ufs -y /dev/md${mdstart}$part > /tmp/fsck.log 2>&1 + dumpfs /dev/md${mdstart}$part > /tmp/dumpfs.2 + + diff -c /tmp/dumpfs.1 /tmp/dumpfs.2 || cat /tmp/fsck.log + mdconfig -d -u $mdstart +done +rm -f /tmp/fsck.log /tmp/dumpfs.? Added: projects/stress2/misc/trim2.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/stress2/misc/trim2.sh Sun Jan 30 12:12:25 2011 (r218087) @@ -0,0 +1,63 @@ +#!/bin/sh + +# +# Copyright (c) 2011 Peter Holm +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +# Run a test on a 128 MB malloc backed MD with UFS SU fs with option trim. +# Verify that deleted records are gone. + +. ../default.cfg + +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart +mdconfig -a -t malloc -o reserve -s 128m -u $mdstart || exit 1 +bsdlabel -w md$mdstart auto +[ $# -eq 0 ] && trim=-t +newfs $trim -U md${mdstart}$part > /dev/null +mount /dev/md${mdstart}$part $mntpoint + +echo "This is a Trim (TRIM) test." >> $mntpoint/file +for i in `jot 20`; do + cat $mntpoint/file $mntpoint/file > $mntpoint/file2 + mv $mntpoint/file2 $mntpoint/file +done +rm $mntpoint/file + +while mount | grep $mntpoint | grep -q /dev/md; do + umount $mntpoint || sleep 1 +done + +grep -a -qm1 Trim /dev/md${mdstart}$part && echo "Test failed" + +fsck -t ufs -y /dev/md${mdstart}$part 2>&1 | tee /tmp/fsck.log | \ + grep -v "IS CLEAN" | egrep -q -m1 "[A-Z][A-Z]" && \ + cat /tmp/fsck.log +mdconfig -d -u $mdstart +rm -f /tmp/fsck.log Added: projects/stress2/misc/trim3.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/stress2/misc/trim3.sh Sun Jan 30 12:12:25 2011 (r218087) @@ -0,0 +1,74 @@ +#!/bin/sh + +# +# Copyright (c) 2011 Peter Holm +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +# Run with marcus.cfg on a 1 GB swap backed MD with option trim. +# A variation of trim.sh + +. ../default.cfg + +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart + +size="1g" +[ $# -eq 0 ] && trim=-t +n=0 +for flag in '' '-U' '-U'; do + n=$((n + 1)) + echo "mdconfig -a -t swap -s $size -u $mdstart" + mdconfig -a -t swap -s $size -u $mdstart || exit 1 + bsdlabel -w md$mdstart auto + + echo "newfs $trim $flag md${mdstart}$part" + newfs $trim $flag md${mdstart}$part > /dev/null + [ $n -eq 3 ] && tunefs -? 2>&1 | grep -q "j enable" && \ + tunefs -j enable /dev/md${mdstart}$part + + mount /dev/md${mdstart}$part $mntpoint + chmod 777 $mntpoint + + export runRUNTIME=10m + export RUNDIR=$mntpoint/stressX + + su $testuser -c 'cd ..; ./run.sh marcus.cfg' > /dev/null 2>&1 + + while mount | grep $mntpoint | grep -q /dev/md; do + umount $mntpoint || sleep 1 + done + dumpfs /dev/md${mdstart}$part > /tmp/dumpfs.1 + sleep 1 + fsck -t ufs -y /dev/md${mdstart}$part > /tmp/fsck.log 2>&1 + dumpfs /dev/md${mdstart}$part > /tmp/dumpfs.2 + + diff -c /tmp/dumpfs.1 /tmp/dumpfs.2 || cat /tmp/fsck.log + mdconfig -d -u $mdstart +done +rm -f /tmp/fsck.log /tmp/dumpfs.? Added: projects/stress2/misc/trim4.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/stress2/misc/trim4.sh Sun Jan 30 12:12:25 2011 (r218087) @@ -0,0 +1,79 @@ +#!/bin/sh + +# +# Copyright (c) 2011 Peter Holm +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +# Run with marcus.cfg on a 1 GB swap backed MD with option trim. +# SU+J FS corruption seen with option trim. + +. ../default.cfg + +tunefs -? 2>&1 | grep "j enable" || exit 1 + +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart + +size="1g" +[ $# -eq 0 ] && trim=-t +flag="-U" +for i in `jot 6`; do + echo "Test #$i `date '+%T'`" + echo "mdconfig -a -t swap -s $size -u $mdstart" + mdconfig -a -t swap -s $size -u $mdstart || exit 1 + bsdlabel -w md$mdstart auto + + echo "newfs $trim $flag md${mdstart}$part" + newfs $trim $flag md${mdstart}$part > /dev/null + tunefs -j enable /dev/md${mdstart}$part + + mount /dev/md${mdstart}$part $mntpoint + chmod 777 $mntpoint + + export runRUNTIME=5m + export RUNDIR=$mntpoint/stressX + + su $testuser -c 'cd ..; ./run.sh marcus.cfg' > /dev/null 2>&1 + + while mount | grep $mntpoint | grep -q /dev/md; do + umount $mntpoint || sleep 1 + done + dumpfs /dev/md${mdstart}$part > /tmp/dumpfs.1 + sleep 1 + fsck -t ufs -y /dev/md${mdstart}$part > /tmp/fsck.log 2>&1 + dumpfs /dev/md${mdstart}$part > /tmp/dumpfs.2 + + if grep -q "FALLBACK TO FULL FSCK" /tmp/fsck.log; then + diff -c /tmp/dumpfs.1 /tmp/dumpfs.2 + cat /tmp/fsck.log + exit 1 + fi + mdconfig -d -u $mdstart +done +rm -f /tmp/fsck.log /tmp/dumpfs.?