public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <eguan@redhat.com>
To: xfs@oss.sgi.com
Subject: Re: [PATCH] xfstests 274: test more code paths
Date: Thu, 16 Aug 2012 14:11:49 +0800	[thread overview]
Message-ID: <20120816061149.GF2088@eguan-t400> (raw)
In-Reply-To: <1342768841-16821-1-git-send-email-eguan@redhat.com>

On Fri, Jul 20, 2012 at 03:20:41PM +0800, Eryu Guan wrote:
> Fill preallocated(update/keep size) space by buffered/direct IO
> 
> Also change the seek uplimit of last round dd from 1023 to 1024
> to completely fill preallocated space.
> 
> Signed-off-by: Eryu Guan <eguan@redhat.com>

Hi, any comments on this one? I tested it on ext4 and xfs. In the keep
size case, ext4 would fail. Xfs could pass the whole test.

Thanks,
Eryu Guan
> ---
>  274     |   95 ++++++++++++++++++++++++++++++++++++---------------------------
>  274.out |    7 +++--
>  2 files changed, 58 insertions(+), 44 deletions(-)
> 
> diff --git a/274 b/274
> index dcad90e..938232a 100755
> --- a/274
> +++ b/274
> @@ -50,52 +50,65 @@ _supported_os IRIX Linux
>  _require_scratch
>  _require_xfs_io_falloc
>  
> -echo "------------------------------"
> -echo "preallocation test"
> -echo "------------------------------"
> -
>  rm -f $seq.full
>  
> -umount $SCRATCH_DEV 2>/dev/null
> -_scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) >>$seq.full 2>&1
> -_scratch_mount
> +do_test()
> +{
> +	local keep_size=""
> +	local dio=""
> +	[ $1 -eq 1 ] && keep_size="-k"
> +	[ $2 -eq 1 ] && dio="oflag=direct"
> +
> +	umount $SCRATCH_DEV 2>/dev/null
> +	_scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) >>$seq.full 2>&1
> +	_scratch_mount
>  
> -# Create a 4k file and Allocate 4M past EOF on that file
> -xfs_io -F -f -c "pwrite 0 4k" -c "falloc -k 4k 4m" $SCRATCH_MNT/test \
> -	>>$seq.full 2>&1 || _fail "failed to create test file"
> +	# Create a 4k file and Allocate 4M past EOF on that file
> +	xfs_io -F -f -c "pwrite 0 4k" -c "falloc $keep_size 4k 4m" $SCRATCH_MNT/test \
> +		>>$seq.full 2>&1 || _fail "failed to create test file"
>  
> -# Fill the rest of the fs completely
> -# Note, this will show ENOSPC errors in $seq.full, that's ok.
> -echo "Fill fs with 1M IOs; ENOSPC expected" >> $seq.full
> -dd if=/dev/zero of=$SCRATCH_MNT/tmp1 bs=1M >>$seq.full 2>&1
> -echo "Fill fs with 4K IOs; ENOSPC expected" >> $seq.full
> -dd if=/dev/zero of=$SCRATCH_MNT/tmp2 bs=4K >>$seq.full 2>&1
> -sync
> -# Last effort, use O_SYNC
> -echo "Fill fs with 4K DIOs; ENOSPC expected" >> $seq.full
> -dd if=/dev/zero of=$SCRATCH_MNT/tmp3 bs=4K oflag=sync >>$seq.full 2>&1
> -# Save space usage info
> -echo "Post-fill space:" >> $seq.full
> -df $SCRATCH_MNT >>$seq.full 2>&1
> +	# Fill the rest of the fs completely
> +	# Note, this will show ENOSPC errors in $seq.full, that's ok.
> +	echo "Fill fs with 1M IOs; ENOSPC expected" >> $seq.full
> +	dd if=/dev/zero of=$SCRATCH_MNT/tmp1 bs=1M >>$seq.full 2>&1
> +	echo "Fill fs with 4K IOs; ENOSPC expected" >> $seq.full
> +	dd if=/dev/zero of=$SCRATCH_MNT/tmp2 bs=4K >>$seq.full 2>&1
> +	sync
> +	# Last effort, use O_SYNC
> +	echo "Fill fs with 4K DIOs; ENOSPC expected" >> $seq.full
> +	dd if=/dev/zero of=$SCRATCH_MNT/tmp3 bs=4K oflag=sync >>$seq.full 2>&1
> +	# Save space usage info
> +	echo "Post-fill space:" >> $seq.full
> +	df $SCRATCH_MNT >>$seq.full 2>&1
> +
> +	# Now attempt a write into all of the preallocated space -
> +	# in a very nasty way, badly fragmenting it and then filling it in.
> +	echo "Fill in prealloc space; fragment at offsets:" >> $seq.full
> +	for i in `seq 1 2 1023`; do
> +		echo -n "$i " >> $seq.full
> +		dd if=/dev/zero of=$SCRATCH_MNT/test seek=$i bs=4K count=1 conv=notrunc $dio \
> +			>>$seq.full 2>/dev/null || _fail "failed to write to test file"
> +	done
> +	sync
> +	echo >> $seq.full
> +	echo "Fill in prealloc space; fill holes at offsets:" >> $seq.full
> +	for i in `seq 2 2 1024`; do
> +		echo -n "$i " >> $seq.full
> +		dd if=/dev/zero of=$SCRATCH_MNT/test seek=$i bs=4K count=1 conv=notrunc $dio \
> +			>>$seq.full 2>/dev/null || _fail "failed to fill test file"
> +	done
> +	sync
> +	echo >> $seq.full
> +}
>  
> -# Now attempt a write into all of the preallocated space -
> -# in a very nasty way, badly fragmenting it and then filling it in.
> -echo "Fill in prealloc space; fragment at offsets:" >> $seq.full
> -for i in `seq 1 2 1023`; do
> -	echo -n "$i " >> $seq.full
> -	dd if=/dev/zero of=$SCRATCH_MNT/test seek=$i bs=4K count=1 conv=notrunc \
> -		>>$seq.full 2>/dev/null || _fail "failed to write to test file"
> -done
> -sync
> -echo >> $seq.full
> -echo "Fill in prealloc space; fill holes at offsets:" >> $seq.full
> -for i in `seq 2 2 1023`; do
> -	echo -n "$i " >> $seq.full
> -	dd if=/dev/zero of=$SCRATCH_MNT/test seek=$i bs=4K count=1 conv=notrunc \
> -		>>$seq.full 2>/dev/null || _fail "failed to fill test file"
> -done
> -sync
> -echo >> $seq.full
> +echo "preallocation test, update size/buffer IO"
> +do_test 0 0
> +echo "preallocation test, update size/direct IO"
> +do_test 0 1
> +echo "preallocation test, keep size/buffer IO"
> +do_test 1 0
> +echo "preallocation test, keep size/direct IO"
> +do_test 1 1
>  
>  echo "done"
>  exit
> diff --git a/274.out b/274.out
> index edbf3cc..b1473bc 100644
> --- a/274.out
> +++ b/274.out
> @@ -1,5 +1,6 @@
>  QA output created by 274
> -------------------------------
> -preallocation test
> -------------------------------
> +preallocation test, update size/buffer IO
> +preallocation test, update size/direct IO
> +preallocation test, keep size/buffer IO
> +preallocation test, keep size/direct IO
>  done
> -- 
> 1.7.10.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

      reply	other threads:[~2012-08-16  6:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-20  7:20 [PATCH] xfstests 274: test more code paths Eryu Guan
2012-08-16  6:11 ` Eryu Guan [this message]

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=20120816061149.GF2088@eguan-t400 \
    --to=eguan@redhat.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