From: rjohnston@sgi.com
To: xfs@oss.sgi.com
Subject: [PATCH 2/3] xfstests: add test for agskip mount option
Date: Tue, 29 Jan 2013 09:39:16 -0600 [thread overview]
Message-ID: <20130129153915.105853779@sgi.com> (raw)
In-Reply-To: 20130129153914.801475275@sgi.com
[-- Attachment #1: xfstests-add-agskip-test.patch --]
[-- Type: text/plain, Size: 5479 bytes --]
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
---
295 | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
295.out | 2
group | 1
3 files changed, 150 insertions(+)
Index: b/295
===================================================================
--- /dev/null
+++ b/295
@@ -0,0 +1,147 @@
+#! /bin/bash
+# FS QA Test No. 295
+#
+# Test agskip mount options
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2013 SGI. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#-----------------------------------------------------------------------
+#
+#
+# This test is a modified version of agskip test written by Alain Renaud.
+#
+# Phase 1: Create an xfs filesystem with AGCOUNT=32 and verify that the
+# AGCOUNT is 32.
+# Phase 2: Mount the filesystem with AGSKIP=3.
+# Phase 3: Verify that the AGSKIP is working correctly:
+# Create a file that spans more than one AG (size=1.5 * AGSIZE)
+# Create another file that is less than AGSIZE.
+# Use xfs_bmap to verify that the second extent is at location
+# previous_AG+1.
+# Continue creating/verifying that the AG's are created 3 AG's
+# apart
+#
+# creator
+owner=rjohnston@sgi.com
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ cd /
+ rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+# real QA test starts here
+rm -f $seq.full
+_require_scratch
+
+BLK_SIZE=4096
+AGCOUNT=32
+AGSKIP=3
+
+# Modify as appropriate.
+_supported_fs xfs
+_supported_os Linux
+
+echo "Phase 1: mkfs the filesystem" >> $seq.full 2>&1
+echo "DEBUG: agcount=${AGCOUNT}" >> $seq.full 2>&1
+_scratch_mkfs_xfs " -dagcount=${AGCOUNT}" \
+ >> $seq.full 2>&1 || _fail "mkfs_xfs failed"
+
+# Get fs agcount
+_agcount=$( xfs_db -r -c 'sb 0' -c 'print' ${SCRATCH_DEV} | \
+ awk '$1 == "agcount" { print $3 }' ) >> $seq.full 2>&1
+_agblocks=$( xfs_db -r -c 'sb 0' -c 'print' ${SCRATCH_DEV} | \
+ awk '$1 == "agblocks" { print $3 }' ) >> $seq.full 2>&1
+
+# Print size in meg
+_agsize=$(( _agblocks * ${BLK_SIZE} / 1024 / 1024 )) >> $seq.full 2>&1
+
+if [[ "${_agcount}" -ne ${AGCOUNT} ]]
+then
+ echo "ERROR: agcount(${_agcount}) value is incorrect " >> $seq.full 2>&1
+ exit
+fi
+
+echo "Phase 2: mount filesystem with agskip option" >> $seq.full 2>&1
+echo "DEBUG: agskip=${AGSKIP} " >> $seq.full 2>&1
+
+# mount
+_scratch_mount "-o agskip=${AGSKIP}" >> $seq.full 2>&1 \
+ || _fail "xfs_mount failed"
+
+echo "Phase 3: test agskip option"
+mkdir ${SCRATCH_MNT}/agskip-${AGSKIP}.dir >> $seq.full 2>&1 \
+ || _fail "mkdir failed"
+
+# make the first file with 2 extents
+FSIZE=$(( ${_agsize} + ( ${_agsize} / 2 )))
+FILE=${SCRATCH_MNT}/agskip-${AGSKIP}.dir/file-0
+echo "DEBUG: making first file with size = ${FSIZE}m" >> $seq.full 2>&1
+xfs_mkfile ${FSIZE}m ${FILE} >> $seq.full 2>&1 \
+ || _fail "failed to make file ${FILE}"
+
+agvalue=$( xfs_bmap -v ${FILE} | awk '$1 == "0:" { print $4 }')
+
+# make sure that the second extent is at location AG+1
+_agtmp=$( xfs_bmap -v ${FILE} | awk '$1 == "1:" { print $4 }')
+
+if [[ $(( ( agvalue + 1 ) % AGCOUNT )) -ne ${_agtmp} ]]
+then
+ echo -n "ERROR: The AG location of extent-1=${_agtmp}" >> $seq.full 2>&1
+ echo " as where extent-0=${agvalue}" >> $seq.full 2>&1
+ exit
+fi
+
+_cmpt=1
+while [[ ${_cmpt} -lt 25 ]]
+do
+ FILE=${SCRATCH_MNT}/agskip-${AGSKIP}.dir/file-${_cmpt}
+ if ! xfs_mkfile 10m ${FILE}
+ then
+ echo "ERROR: failed to make file ${FILE}" >> $seq.full 2>&1
+ exit
+ fi
+ _agtmp=$( xfs_bmap -v ${FILE} | awk '$1 == "0:" { print $4 }')
+ if [[ $(( ( agvalue + AGSKIP ) % AGCOUNT )) -ne ${_agtmp} ]]
+ then
+ echo "ERROR: The AG location of file ${FILE} not at AG+${AGSKIP}" \
+ >> $seq.full 2>&1
+ echo " old AG == ${agvalue} new AG == ${_agtmp}" >> $seq.full 2>&1
+ exit
+ fi
+ agvalue=${_agtmp}
+ let _cmpt++
+done
+
+echo "# unmounting scratch" >> $seq.full 2>&1
+${UMOUNT_PROG} ${SCRATCH_MNT} >>$seq.full 2>&1 || _fail "unmount failed"
+
+# success, all done
+status=0
+_cleanup
+exit
Index: b/295.out
===================================================================
--- /dev/null
+++ b/295.out
@@ -0,0 +1,2 @@
+QA output created by 295
+Phase 3: test agskip option
Index: b/group
===================================================================
--- a/group
+++ b/group
@@ -413,3 +413,4 @@ deprecated
292 auto mkfs quick
293 auto quick
294 auto quick
+294 auto mount
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-01-29 15:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-29 15:39 [PATCH 0/3] Add agskip=value mount option rjohnston
2013-01-29 15:39 ` [PATCH 1/3] xfs: add " rjohnston
2013-01-29 20:45 ` Eric Sandeen
2013-01-29 20:57 ` Eric Sandeen
2013-01-30 1:04 ` Dave Chinner
2013-01-30 23:32 ` Ben Myers
2013-01-31 6:13 ` Dave Chinner
2013-01-31 20:24 ` Rich Johnston
2013-02-04 13:18 ` Dave Chinner
2013-01-29 15:39 ` rjohnston [this message]
2013-01-29 15:39 ` [PATCH 3/3] --- sys-utils/mount.8 | 12 ++++++++++++ 1 file changed, 12 insertions(+) rjohnston
2013-01-29 17:59 ` [PATCH 0/3] Add agskip=value mount option Eric Sandeen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130129153915.105853779@sgi.com \
--to=rjohnston@sgi.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox