public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: fstests@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/2] xfstests: add data integtiry test for e4defrag ext4/307
Date: Wed, 23 Jul 2014 07:05:33 +1000	[thread overview]
Message-ID: <20140722210533.GK20518@dastard> (raw)
In-Reply-To: <1406061455-731-1-git-send-email-dmonakhov@openvz.org>

On Wed, Jul 23, 2014 at 12:37:34AM +0400, Dmitry Monakhov wrote:
> 
> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>

Needs a proper commit message.

Also, what makes this ext4 specific? Why can't it run on any
filesystem with a defrag operation?

> +_need_to_be_root
> +_require_scratch
> +_require_defrag
> +
> +rm -f $seqres.full
> +
> +_workout()
> +{
> +    	nr=$1
> +	echo "Defragment file with $nr * 2 fragments"
> +	# Create sparse file
> +    	for ((i=0;i<nr;i++))
> +	do
> +	    fallocate -l 4k -o $((409600*i)) $SCRATCH_MNT/test.$nr
> +	done

please use $XFS_IO_PROG -c "falloc" ... for these operations to minimise
the number of external dependencies...


> +	# Fill holes for half of range , as result file will contain nr*1.5 fragments
> +	fallocate -l $((204800*nr)) $SCRATCH_MNT/test.$nr
> +	# Data wrilte will convert extetns to inialized ones
> +    	for ((i=0;i<nr;i++))

whitespace

> +	do
> +	    dd if=/dev/urandom bs=1234 seek=$((100*i)) of=$SCRATCH_MNT/test.$nr \
> +		conv=notrunc count=3 >> $seqres.full 2>&1
> +	done

again, $XFS_IO_PROG -c "pwrite .." rather than dd. And use a fixed
pattern, so that the hash of the file is predictable.


> +	filefrag -v $SCRATCH_MNT/test.$nr >> $seqres.full

$XFS_IO_PROG -c "fiemap" ....

> +	sha1sum $SCRATCH_MNT/test.$nr > $SCRATCH_MNT/test.$nr.sha1sum

md5sum is sufficient and faster for this sort of testing, and used
everywhere else in xfstests for this purpose. And with predictable
file contents, the output can be dumped into the output file like:

	md5sum $SCRATCH_MNT/test.$nr | _filter_scratch

And so we get file contents integrity checking from both the initial
write and the defrag command...

> +	$DEFRAG_PROG $SCRATCH_MNT $SCRATCH_DEV >> $seqres.full 2>&1
> +	filefrag -v $SCRATCH_MNT/test.$nr >> $seqres.full
> +	run_check sha1sum -c $SCRATCH_MNT/test.$nr.sha1sum

And this run_check can go away - just dump the md5sum again.

-Dave.
-- 
Dave Chinner
david@fromorbit.com

      parent reply	other threads:[~2014-07-22 21:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-22 20:37 [PATCH 1/2] xfstests: add data integtiry test for e4defrag ext4/307 Dmitry Monakhov
2014-07-22 20:37 ` [PATCH 2/2] xfstests: add new defragmentation test (compacting case) Dmitry Monakhov
2014-07-22 21:05 ` Dave Chinner [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=20140722210533.GK20518@dastard \
    --to=david@fromorbit.com \
    --cc=dmonakhov@openvz.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    /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