[Ocfs2-test-devel] [PATCH 1/1] Ocfs2-test: Improve resize_test.sh for tunefs.ocfs2 changes.
tristan.ye
tristan.ye at oracle.com
Tue Jun 9 01:37:52 PDT 2009
On Tue, 2009-06-09 at 16:13 +0800, Tao Ma wrote:
> Hi Tristan,
>
> Tristan Ye wrote:
> > As the output of new tunefs.ocfs2 changed when doing resizing(Now it
> > output nothing even if we turn the vebose mode on), our test tools
> > therefore need to be updated accordingly. from my point of view, it
> > would be better to both check the return code of the testing cmd and
> > output of debugfs.ocfs2 to see if the volume size grows correctly.
> >
> > Some other improvements also included in the patches for permission and
> > path problems.
> >
> > Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
> > ---
> > programs/resize_test/resize_test.sh | 39 ++++++++++++++++++++++------------
> > 1 files changed, 25 insertions(+), 14 deletions(-)
> >
> > diff --git a/programs/resize_test/resize_test.sh b/programs/resize_test/resize_test.sh
> > index 9a243ed..f14bbf0 100755
> > --- a/programs/resize_test/resize_test.sh
> > +++ b/programs/resize_test/resize_test.sh
> > @@ -7,7 +7,11 @@
> > # blocks, where each chunk has to be greater than a cluster
> > #
> >
> > -PATH=$PATH:/sbin # Add /sbin to the path for ocfs2 tools
> > +if [ -f `dirname ${0}`/config.sh ]; then
> > + . `dirname ${0}`/config.sh
> > +fi
> > +
> > +PATH=$PATH:/sbin:${BINDIR} # Add /sbin to the path for ocfs2 tools
> >
> > usage() {
> > echo "usage: resize_test.sh -c -o <outdir> -d <device> -i <iters> -l <label> -m <mntdir> -n <nodelist>"
> > @@ -165,6 +169,7 @@ do_debugfs() {
> > }
> >
> > do_tunefs() {
> > +
> > if [ "$#" -lt "2" ]
> > then
> > echo "do_tunefs(): <out> <blk>" >&2
> > @@ -179,21 +184,21 @@ do_tunefs() {
> > else
> > echo -n "grow device to ${blk} blocks "
> > fi
> > - echo ${TUNEFS} -S ${device} ${blk} > ${out}
> > - ${TUNEFS} -x -S ${device} ${blk} >>${out} 2>&1
> > - ${GREP} "Cannot grow volume size" ${out} >/dev/null 2>&1
> > - if [ $? -eq 0 ]
> > - then
> > - echo "OK (ENOSPC)"
> > - return 1
> > + echo ${TUNEFS} -v -S ${device} ${blk} > ${out}
> > + ${TUNEFS} -v -S ${device} ${blk} >>${out} 2>&1
> > +
> > + if [ $? -eq 0 ]; then
> > + g_size=`${DEBUGFS} -R "stat //global_bitmap" ${device} 2>/dev/null | awk '/Size:/ {print $8;}'`
> > + blocks=$((${g_size}/${blocksz}))
> > + if [ "${blocks}" != "${blk}" ]; then
> > + echo "FAILED, wanted to grow ${blk}, but got ${blocks} instead"
> > + return 1
> > + fi
> > + else
> > + echo "FAILED. Errors in ${out}"
> > + exit 1
> One more thing.
> you can't check whether "${blocks}" != "${blk}".
> tunefs.ocfs2 will align the block number to cluster range.
> So you have to change "blk" somehow if it isn't aligned to the cluster
> range.
Yes, it may become a potential bug here, thank you for pointing this
out!!
Tristan.
>
> Regards,
> Tao
More information about the Ocfs2-test-devel
mailing list