From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: Dave Chinner <david@fromorbit.com>
Cc: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 RESEND 2/5] fstests: btrfs: Add basic test for btrfs in-band de-duplication
Date: Mon, 29 Feb 2016 10:04:35 +0800 [thread overview]
Message-ID: <56D3A733.7010608@cn.fujitsu.com> (raw)
In-Reply-To: <20160228222627.GA29057@dastard>
Hi Dave,
Thanks for the review.
All comment are correct and I'll update the patchset soon.
Only one small question below
Dave Chinner wrote on 2016/02/29 09:26 +1100:
...
>> +# File size is twice the maximum file extent of btrfs
>> +# So even fallbacked to non-dedup, it will have at least 2 extents
>> +file_size=$(( 256 * 1024 * 1024 ))
>
> Used for xfs_io, so "file_size=256m" is all that is needed here.
Super nice feature for support unit suffix, I checked man page of xfs_io
but only value for extsize mentioned the support for such suffix.
I assume all offset/length/bsize/value support suffix, right?
Hope man page get updated.
Thanks,
Qu
>
>> +_scratch_mkfs "-O dedup" >> $seqres.full 2>&1
>> +_scratch_mount
>> +
>> +do_dedup_test()
>> +{
>> + backend=$1
>> + dedup_bs=$2
>> +
>> + _run_btrfs_util_prog dedup enable -s $backend -b $dedup_bs $SCRATCH_MNT
>> + $XFS_IO_PROG -f -c "pwrite -b $dedup_bs 0 $dedup_bs" \
>> + $SCRATCH_MNT/initial_block | _filter_xfs_io
>> +
>> + # sync to ensure dedup hash is added into dedup pool
>> + sync
>
> xfs_io -fs or xfs_io ... -c "fsync" ... ?
>
>> + $XFS_IO_PROG -f -c "pwrite -b $dedup_bs 0 $file_size" \
>> + $SCRATCH_MNT/real_file | _filter_xfs_io
>> + # sync again to ensure data are all written to disk and
>> + # we can get stable extent map
>> + sync
>
> Again, why now just do a sync write or fsync from the xfs?
>
>> +
>> + # Test if real_file is de-duplicated
>> + nr_uniq_extents=$(_uniq_extent_count $SCRATCH_MNT/real_file)
>> + nr_total_extents=$(_extent_count $SCRATCH_MNT/real_file)
>> +
>> + echo "uniq/total: $nr_uniq_extents/$nr_total_extents" >> $seqres.full
>> + # Allow a small amount of dedup miss, as commit interval or
>> + # memory pressure may break a dedup_bs block and cause
>> + # smalll extent which won't go through dedup routine
>> + if [ $nr_uniq_extents -ge $(( $nr_total_extents * 5 / 100 )) ]; then
>> + echo "Too high dedup failure rate"
>> + fi
>
> _within_tolerance
>
>> +
>> + # Also check the md5sum to ensure data is not corrupted
>> + md5=$(_md5_checksum $SCRATCH_MNT/real_file)
>> + if [ $md5 != $init_md5 ]; then
>> + echo "File after in-band de-duplication is corrupted"
>> + fi
>
> Nope. Just echo the md5sum to the golden output file.
>
>
>> +}
>> +
>> +# Create the initial file and calculate its checksum without dedup
>> +$XFS_IO_PROG -f -c "pwrite 0 $file_size" $SCRATCH_MNT/csum_file | \
>> + _filter_xfs_io
>> +init_md5=$(_md5_checksum $SCRATCH_MNT/csum_file)
>> +echo "md5 of the initial file is $init_md5" >> $seqres.full
>
> Just echo the md5sum to the golden output file.
>
> Cheers,
>
> Dave.
>
WARNING: multiple messages have this Message-ID (diff)
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: Dave Chinner <david@fromorbit.com>
Cc: <fstests@vger.kernel.org>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v2 RESEND 2/5] fstests: btrfs: Add basic test for btrfs in-band de-duplication
Date: Mon, 29 Feb 2016 10:04:35 +0800 [thread overview]
Message-ID: <56D3A733.7010608@cn.fujitsu.com> (raw)
In-Reply-To: <20160228222627.GA29057@dastard>
Hi Dave,
Thanks for the review.
All comment are correct and I'll update the patchset soon.
Only one small question below
Dave Chinner wrote on 2016/02/29 09:26 +1100:
...
>> +# File size is twice the maximum file extent of btrfs
>> +# So even fallbacked to non-dedup, it will have at least 2 extents
>> +file_size=$(( 256 * 1024 * 1024 ))
>
> Used for xfs_io, so "file_size=256m" is all that is needed here.
Super nice feature for support unit suffix, I checked man page of xfs_io
but only value for extsize mentioned the support for such suffix.
I assume all offset/length/bsize/value support suffix, right?
Hope man page get updated.
Thanks,
Qu
>
>> +_scratch_mkfs "-O dedup" >> $seqres.full 2>&1
>> +_scratch_mount
>> +
>> +do_dedup_test()
>> +{
>> + backend=$1
>> + dedup_bs=$2
>> +
>> + _run_btrfs_util_prog dedup enable -s $backend -b $dedup_bs $SCRATCH_MNT
>> + $XFS_IO_PROG -f -c "pwrite -b $dedup_bs 0 $dedup_bs" \
>> + $SCRATCH_MNT/initial_block | _filter_xfs_io
>> +
>> + # sync to ensure dedup hash is added into dedup pool
>> + sync
>
> xfs_io -fs or xfs_io ... -c "fsync" ... ?
>
>> + $XFS_IO_PROG -f -c "pwrite -b $dedup_bs 0 $file_size" \
>> + $SCRATCH_MNT/real_file | _filter_xfs_io
>> + # sync again to ensure data are all written to disk and
>> + # we can get stable extent map
>> + sync
>
> Again, why now just do a sync write or fsync from the xfs?
>
>> +
>> + # Test if real_file is de-duplicated
>> + nr_uniq_extents=$(_uniq_extent_count $SCRATCH_MNT/real_file)
>> + nr_total_extents=$(_extent_count $SCRATCH_MNT/real_file)
>> +
>> + echo "uniq/total: $nr_uniq_extents/$nr_total_extents" >> $seqres.full
>> + # Allow a small amount of dedup miss, as commit interval or
>> + # memory pressure may break a dedup_bs block and cause
>> + # smalll extent which won't go through dedup routine
>> + if [ $nr_uniq_extents -ge $(( $nr_total_extents * 5 / 100 )) ]; then
>> + echo "Too high dedup failure rate"
>> + fi
>
> _within_tolerance
>
>> +
>> + # Also check the md5sum to ensure data is not corrupted
>> + md5=$(_md5_checksum $SCRATCH_MNT/real_file)
>> + if [ $md5 != $init_md5 ]; then
>> + echo "File after in-band de-duplication is corrupted"
>> + fi
>
> Nope. Just echo the md5sum to the golden output file.
>
>
>> +}
>> +
>> +# Create the initial file and calculate its checksum without dedup
>> +$XFS_IO_PROG -f -c "pwrite 0 $file_size" $SCRATCH_MNT/csum_file | \
>> + _filter_xfs_io
>> +init_md5=$(_md5_checksum $SCRATCH_MNT/csum_file)
>> +echo "md5 of the initial file is $init_md5" >> $seqres.full
>
> Just echo the md5sum to the golden output file.
>
> Cheers,
>
> Dave.
>
next prev parent reply other threads:[~2016-02-29 2:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-24 8:06 [PATCH v2 RESEND 0/5] Btrfs in-band de-duplication tests cases Qu Wenruo
2016-02-24 8:06 ` [PATCH v2 RESEND 1/5] fstests: rename _require_btrfs to _require_btrfs_subcommand Qu Wenruo
2016-02-24 8:06 ` [PATCH v2 RESEND 2/5] fstests: btrfs: Add basic test for btrfs in-band de-duplication Qu Wenruo
2016-02-28 22:26 ` Dave Chinner
2016-02-29 2:04 ` Qu Wenruo [this message]
2016-02-29 2:04 ` Qu Wenruo
2016-02-29 6:43 ` Dave Chinner
2016-02-29 7:55 ` Qu Wenruo
2016-02-29 7:55 ` Qu Wenruo
2016-02-24 8:06 ` [PATCH v2 RESEND 3/5] fstests: btrfs: Add testcase for btrfs dedup enable disable race test Qu Wenruo
2016-02-28 22:29 ` Dave Chinner
2016-02-24 8:06 ` [PATCH v2 RESEND 4/5] fstests: btrfs: Add per inode dedup flag test Qu Wenruo
2016-02-28 22:39 ` Dave Chinner
2016-02-24 8:06 ` [PATCH v2 RESEND 5/5] fstests: btrfs: Test inband dedup with balance Qu Wenruo
2016-02-28 22:42 ` Dave Chinner
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=56D3A733.7010608@cn.fujitsu.com \
--to=quwenruo@cn.fujitsu.com \
--cc=david@fromorbit.com \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.