xfstests: 223 - test file alignment on stripe geometry
PATCH 1/1 xfstests: 223 - test file alignment on stripe geometry
A first-cut test to ensure that files are well-aligned on filesystems with stripe geometry.
Several sizes of stripe units are mkfs'd, and then files are written and fallocated in various multiples of those stripe sizes. Each file is checked to ensure that the first block is stripe-aligned.
(Ideally, for any fragmented files, we should ensure that each fragment start is well-aligned, but this does not do that yet)
(slightly unrelated: don't send scratch mkfs output to /dev/null)
---
223 new file +120 -0
@@ -0,0 +1,120 @@ +#! /bin/bash +# FS QA Test No. 223 +# +# File alignment tests +# +#----------------------------------------------------------------------- +# Copyright (c) 2010 Eric Sandeen. 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 +# +#----------------------------------------------------------------------- +# +# creator [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + rm -f $tmp.* +} + +trap "_cleanup ; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +# real QA test starts here +_supported_fs xfs ext4 +_supported_os Linux + +_require_scratch +_require_xfs_io_falloc + +rm -f $seq.full + +_filter_scratch() +{ + sed -e "s,$SCRATCH_MNT,SCRATCH_MNT,g" +} + +BLOCKSIZE=4096 + +scratch_mkfs_geom() +{ + sunit_bytes=$1 + swidth_mult=$2 + + let sunit_blocks=$sunit_bytes/$BLOCKSIZE + let swidth_blocks=$sunit_blocks*$swidth_mult + + case $FSTYP in + xfs) + MKFS_OPTIONS="-b size=$BLOCKSIZE, -d su=$sunit_bytes,sw=$swidth_mult" + ;; + ext4) + MKFS_OPTIONS="-b $BLOCKSIZE -E stride=$sunit_blocks,stripe_width=$swidth_blocks" + ;; + *) + _notrun "can't mkfs $FSTYP with geometry" + ;; + esac + echo "=== mkfs with su $sunit_blocks blocks x $swidth_mult ===" + _scratch_mkfs &>> $seq.full +} + +# Emulate a 4-data-disk stripe w/ various stripe units + +for SUNIT_K in 8 16 32 64 128; do + let SUNIT_BYTES=$SUNIT_K*1024 + let SUNIT_BLOCKS=$SUNIT_BYTES/$BLOCKSIZE + + scratch_mkfs_geom $SUNIT_BYTES 4 + _scratch_mount + + for SIZE_MULT in 1 2 8 64 256; do + let SIZE=$SIZE_MULT*$SUNIT_BYTES + + echo "=== Testing size ${SIZE_MULT}*${SUNIT_K}k on ${SUNIT_K}k stripe ===" + for FILE in 1 2 3 4; do + xfs_io -F -f -c "falloc 0 $SIZE" $SCRATCH_MNT/file-$FILE-$SIZE-falloc &>> $seq.full + xfs_io -F -f -c "pwrite 0 $SIZE" $SCRATCH_MNT/file-$FILE-$SIZE-write &>> $seq.full + src/fibmap $SCRATCH_MNT/file-$FILE-$SIZE-falloc $SUNIT_BLOCKS | \ + _filter_scratch + src/fibmap $SCRATCH_MNT/file-$FILE-$SIZE-write $SUNIT_BLOCKS | \ + _filter_scratch + done + done + + echo "=== Testing size 1g falloc on ${SUNIT_K}k stripe ===" + xfs_io -F -f -c "falloc 0 1g" $SCRATCH_MNT/file-1g-falloc &>> $seq.full + src/fibmap $SCRATCH_MNT/file-1g-falloc $SUNIT_BLOCKS + + rm -f $SCRATCH_MNT/file-1g-falloc | _filter_scratch + + echo "=== Testing size 1073745920 falloc on ${SUNIT_K}k stripe ===" + xfs_io -F -f -c "falloc 0 1073745920" $SCRATCH_MNT/file-1073745920-falloc &>> $seq.full + src/fibmap $SCRATCH_MNT/file-1073745920-falloc $SUNIT_BLOCKS | _filter_scratch + + _scratch_unmount +done + +status=0 ; exit
223.out new file +251 -0
251 lines not on this page · raw message
common.rc +1 -1
@@ -292,7 +292,7 @@ _scratch_mkfs() $MKFS_UDF_PROG $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null ;; *) - /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null + /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV ;; esac }
group +1 -0
@@ -336,3 +336,4 @@ deprecated 220 auto quota quick 221 auto metadata quick 222 auto fsr ioctl quick +223 auto quick
src/Makefile +1 -1
@@ -14,7 +14,7 @@ TARGETS = dirstress fill fill2 getpagesize holes lstat64 \ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \ preallo_rw_pattern_writer ftrunc trunc fs_perms testx looptest \ - locktest unwritten_mmap bulkstat_unlink_test \ + locktest unwritten_mmap bulkstat_unlink_test fibmap \ bulkstat_unlink_test_modified t_dir_offset t_futimens t_immutable SUBDIRS =
src/fibmap.c new file +76 -0
76 lines not on this page · raw message
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
223 line 46
Quoted 2 lines
223 new file +2
-0+# real QA test starts here +_supported_fs xfs ext4
I'd make this generic and just do the notrun in scratch_mkfs_geom for non-supported filesystems.
223 line 62
Quoted 2 lines
223 new file +2
-0+scratch_mkfs_geom() +{
And I'd throw this one into common.rc.
common.rc _scratch_mkfs() · line 295
Quoted 12 lines
+=== Testing size 1073745920 falloc on 128k stripe ===
(quoted diff) +1
-0+SCRATCH_MNT/file-1073745920-falloc: well-alignedcommon.rc +1
-1@@ -292,7 +292,7 @@ _scratch_mkfs() $MKFS_UDF_PROG $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null ;; *) - /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null + /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV
Hmm, doesn't this change break other testcase? Anyway needs some rationale in the changelog.
src/fibmap.c
Quoted 3 lines
index 0000000..fa005b2
src/fibmap.c new file +0
-0
This is a bit misnamed as it's not a generic fibmap tool but rather a specific tool comparing the bmap to the sunit alignment.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 5 lines · Christoph Hellwig
223 line 46
Quoted 2 lines
223 new file +2
-0+# real QA test starts here +_supported_fs xfs ext4I'd make this generic and just do the notrun in
scratch_mkfs_geomfor non-supported filesystems.
fair enough
Quoted 4 lines
223 line 62
Quoted 2 lines
223 new file +2
-0+scratch_mkfs_geom() +{And I'd throw this one into common.rc.
ok
Quoted 7 lines
Quoted 7 lines
+=== Testing size 1073745920 falloc on 128k stripe ===
(quoted diff) +1
-0+SCRATCH_MNT/file-1073745920-falloc: well-alignedcommon.rc +0
-0@@ -292,7 +292,7 @@ _scratch_mkfs()
Quoted 8 lines
common.rc _scratch_mkfs() · line 295
Quoted 5 lines
common.rc +1
-1$MKFS_UDF_PROG $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null ;; *) - /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null + /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEVHmm, doesn't this change break other testcase? Anyway needs some rationale in the changelog.
didn't break anything for me; I wanted to be able to see the mkfs results w/ geometry, is all. Will re-double-check but it was fine AFAIK.
Quoted 7 lines
src/fibmap.c
Quoted 3 lines
index 0000000..fa005b2
src/fibmap.c new file +0
-0This is a bit misnamed as it's not a generic fibmap tool but rather a specific tool comparing the bmap to the sunit alignment.
good point .. how about making it more generic, something like:
fibmap -o <file offset> -l <length> -s <stripe alignment> <filename>
hmm though I hate to reqwrite filefrag ... :)
I suppose something like this could go into xfs_io as well, but that makes this test unavailable to the masses until another release, at least.
-Eric
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 2 lines
didn't break anything for me; I wanted to be able to see the mkfs results w/ geometry, is all. Will re-double-check but it was fine AFAIK.
Yeah, doesn't seem to cause any problems with a full xfsqa run for me.
Quoted 4 lines
Quoted 3 lines
This is a bit misnamed as it's not a generic fibmap tool but rather a specific tool comparing the bmap to the sunit alignment.
Quoted 8 lines
good point .. how about making it more generic, something like:
fibmap -o <file offset> -l <length> -s <stripe alignment> <filename>
hmm though I hate to reqwrite filefrag ... :)
I suppose something like this could go into
xfs_ioas well, but that makes this test unavailable to the masses until another release, at least.
I'd just leave it as is but call it t_stripealign or similar.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v2 1/1 xfstests: 223 - test file alignment on stripe geometry
In reply to Christoph HellwigA first-cut test to ensure that files are well-aligned on filesystems with stripe geometry.
Several sizes of stripe units are mkfs'd, and then files are written and fallocated in various multiples of those stripe sizes. Each file is checked to ensure that the first block is stripe-aligned.
(Ideally, for any fragmented files, we should ensure that each fragment start is well-aligned, but this does not do that yet)
(slightly unrelated: don't send scratch mkfs output to /dev/null, we'd like to see mkfs output and direct it to $seq.full - this more or less matches _scratch_mkfs_xfs behavior and doesn't break any tests that I can see)
---
V2: Address Christoph's review comments
223 new file +96 -0
@@ -0,0 +1,96 @@ +#! /bin/bash +# FS QA Test No. 223 +# +# File alignment tests +# +#----------------------------------------------------------------------- +# Copyright (c) 2010 Eric Sandeen. 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 +# +#----------------------------------------------------------------------- +# +# creator [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + rm -f $tmp.* +} + +trap "_cleanup ; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +# real QA test starts here +_supported_fs generic +_supported_os Linux + +_require_scratch +_require_xfs_io_falloc + +rm -f $seq.full + +_filter_scratch() +{ + sed -e "s,$SCRATCH_MNT,SCRATCH_MNT,g" +} + +BLOCKSIZE=4096 + +for SUNIT_K in 8 16 32 64 128; do + let SUNIT_BYTES=$SUNIT_K*1024 + let SUNIT_BLOCKS=$SUNIT_BYTES/$BLOCKSIZE + + echo "=== mkfs with su $SUNIT_BLOCKS blocks x 4 ===" + scratch_mkfs_geom $BLOCKSIZE $SUNIT_BYTES 4 + _scratch_mount + + for SIZE_MULT in 1 2 8 64 256; do + let SIZE=$SIZE_MULT*$SUNIT_BYTES + + echo "=== Testing size ${SIZE_MULT}*${SUNIT_K}k on ${SUNIT_K}k stripe ===" + for FILE in 1 2 3 4; do + xfs_io -F -f -c "falloc 0 $SIZE" $SCRATCH_MNT/file-$FILE-$SIZE-falloc &>> $seq.full + xfs_io -F -f -c "pwrite 0 $SIZE" $SCRATCH_MNT/file-$FILE-$SIZE-write &>> $seq.full + src/fibmap $SCRATCH_MNT/file-$FILE-$SIZE-falloc $SUNIT_BLOCKS | \ + _filter_scratch + src/fibmap $SCRATCH_MNT/file-$FILE-$SIZE-write $SUNIT_BLOCKS | \ + _filter_scratch + done + done + + echo "=== Testing size 1g falloc on ${SUNIT_K}k stripe ===" + xfs_io -F -f -c "falloc 0 1g" $SCRATCH_MNT/file-1g-falloc &>> $seq.full + src/fibmap $SCRATCH_MNT/file-1g-falloc $SUNIT_BLOCKS + + rm -f $SCRATCH_MNT/file-1g-falloc | _filter_scratch + + echo "=== Testing size 1073745920 falloc on ${SUNIT_K}k stripe ===" + xfs_io -F -f -c "falloc 0 1073745920" $SCRATCH_MNT/file-1073745920-falloc &>> $seq.full + src/fibmap $SCRATCH_MNT/file-1073745920-falloc $SUNIT_BLOCKS | _filter_scratch + + _scratch_unmount +done + +status=0 ; exit
223.out new file +251 -0
251 lines not on this page · raw message
common.rc +25 -1
@@ -300,11 +300,35 @@ _scratch_mkfs() $MKFS_UDF_PROG $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null ;; *) - /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null + /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV ;; esac } +scratch_mkfs_geom() +{ + blocksize=$1 + sunit_bytes=$2 + swidth_mult=$3 + + let sunit_blocks=$sunit_bytes/$blocksize + let swidth_blocks=$sunit_blocks*$swidth_mult + + case $FSTYP in + xfs) + MKFS_OPTIONS="-b size=$blocksize, -d su=$sunit_bytes,sw=$swidth_mult" + ;; + ext4) + MKFS_OPTIONS="-b $blocksize -E stride=$sunit_blocks,stripe_width=$swidth_blocks" + ;; + *) + _notrun "can't mkfs $FSTYP with geometry" + ;; + esac + _scratch_mkfs &>> $seq.full +} + +# Emulate a 4-data-disk stripe w/ various stripe units _scratch_xfs_db_options() { SCRATCH_OPTIONS=""
group +1 -0
@@ -336,3 +336,4 @@ deprecated 220 auto quota quick 221 auto metadata quick 222 auto fsr ioctl quick +223 auto quick
src/Makefile +1 -1
@@ -14,7 +14,7 @@ TARGETS = dirstress fill fill2 getpagesize holes lstat64 \ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \ preallo_rw_pattern_writer ftrunc trunc fs_perms testx looptest \ - locktest unwritten_mmap bulkstat_unlink_test \ + locktest unwritten_mmap bulkstat_unlink_test t_stripealign \ bulkstat_unlink_test_modified t_dir_offset t_futimens t_immutable SUBDIRS =
src/t_stripealign.c new file +72 -0
72 lines not on this page · raw message
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v3 1/1 xfstests: 223 - test file alignment on stripe geometry
A first-cut test to ensure that files are well-aligned on filesystems with stripe geometry.
Several sizes of stripe units are mkfs'd, and then files are written and fallocated in various multiples of those stripe sizes. Each file is checked to ensure that the first block is stripe-aligned.
(Ideally, for any fragmented files, we should ensure that each fragment start is well-aligned, but this does not do that yet)
(slightly unrelated: don't send scratch mkfs output to /dev/null, we'd like to see mkfs output and direct it to $seq.full - this more or less matches _scratch_mkfs_xfs behavior and doesn't break any tests that I can see)
---
V2: Address Christoph's review comments
V3: add missing _ to the helper function, minor cleanups
to the common.rc file
(sorry for all the versions) :)
223 new file +96 -0
@@ -0,0 +1,96 @@ +#! /bin/bash +# FS QA Test No. 223 +# +# File alignment tests +# +#----------------------------------------------------------------------- +# Copyright (c) 2010 Eric Sandeen. 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 +# +#----------------------------------------------------------------------- +# +# creator [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + rm -f $tmp.* +} + +trap "_cleanup ; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +# real QA test starts here +_supported_fs generic +_supported_os Linux + +_require_scratch +_require_xfs_io_falloc + +rm -f $seq.full + +_filter_scratch() +{ + sed -e "s,$SCRATCH_MNT,SCRATCH_MNT,g" +} + +BLOCKSIZE=4096 + +for SUNIT_K in 8 16 32 64 128; do + let SUNIT_BYTES=$SUNIT_K*1024 + let SUNIT_BLOCKS=$SUNIT_BYTES/$BLOCKSIZE + + echo "=== mkfs with su $SUNIT_BLOCKS blocks x 4 ===" + _scratch_mkfs_geom $BLOCKSIZE $SUNIT_BYTES 4 &>> $seq.full + _scratch_mount + + for SIZE_MULT in 1 2 8 64 256; do + let SIZE=$SIZE_MULT*$SUNIT_BYTES + + echo "=== Testing size ${SIZE_MULT}*${SUNIT_K}k on ${SUNIT_K}k stripe ===" + for FILE in 1 2 3 4; do + xfs_io -F -f -c "falloc 0 $SIZE" $SCRATCH_MNT/file-$FILE-$SIZE-falloc &>> $seq.full + xfs_io -F -f -c "pwrite 0 $SIZE" $SCRATCH_MNT/file-$FILE-$SIZE-write &>> $seq.full + src/fibmap $SCRATCH_MNT/file-$FILE-$SIZE-falloc $SUNIT_BLOCKS | \ + _filter_scratch + src/fibmap $SCRATCH_MNT/file-$FILE-$SIZE-write $SUNIT_BLOCKS | \ + _filter_scratch + done + done + + echo "=== Testing size 1g falloc on ${SUNIT_K}k stripe ===" + xfs_io -F -f -c "falloc 0 1g" $SCRATCH_MNT/file-1g-falloc &>> $seq.full + src/fibmap $SCRATCH_MNT/file-1g-falloc $SUNIT_BLOCKS + + rm -f $SCRATCH_MNT/file-1g-falloc | _filter_scratch + + echo "=== Testing size 1073745920 falloc on ${SUNIT_K}k stripe ===" + xfs_io -F -f -c "falloc 0 1073745920" $SCRATCH_MNT/file-1073745920-falloc &>> $seq.full + src/fibmap $SCRATCH_MNT/file-1073745920-falloc $SUNIT_BLOCKS | _filter_scratch + + _scratch_unmount +done + +status=0 ; exit
223.out new file +251 -0
251 lines not on this page · raw message
common.rc +27 -1
@@ -292,11 +292,37 @@ _scratch_mkfs() $MKFS_UDF_PROG $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null ;; *) - /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV > /dev/null + /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV ;; esac } +# Emulate an N-data-disk stripe w/ various stripe units +# _scratch_mkfs_geom <sunit bytes> <swidth multiplier> [optional blocksize] +_scratch_mkfs_geom() +{ + sunit_bytes=$1 + swidth_mult=$2 + blocksize=$3 + [ -z "$blocksize" ] && blocksize=4096 + + let sunit_blocks=$sunit_bytes/$blocksize + let swidth_blocks=$sunit_blocks*$swidth_mult + + case $FSTYP in + xfs) + MKFS_OPTIONS="-b size=$blocksize, -d su=$sunit_bytes,sw=$swidth_mult" + ;; + ext4) + MKFS_OPTIONS="-b $blocksize -E stride=$sunit_blocks,stripe_width=$swidth_blocks" + ;; + *) + _notrun "can't mkfs $FSTYP with geometry" + ;; + esac + _scratch_mkfs +} + _scratch_xfs_db_options() { SCRATCH_OPTIONS=""
group +1 -0
@@ -336,3 +336,4 @@ deprecated 220 auto quota quick 221 auto metadata quick 222 auto fsr ioctl quick +223 auto quick
src/Makefile +1 -1
@@ -14,7 +14,7 @@ TARGETS = dirstress fill fill2 getpagesize holes lstat64 \ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \ preallo_rw_pattern_writer ftrunc trunc fs_perms testx looptest \ - locktest unwritten_mmap bulkstat_unlink_test \ + locktest unwritten_mmap bulkstat_unlink_test t_stripealign \ bulkstat_unlink_test_modified t_dir_offset t_futimens t_immutable SUBDIRS =
src/t_stripealign.c new file +68 -0
68 lines not on this page · raw message
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Looks good to me, and although I haven't tested the respin yet myself it looks close enough to the original one.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs