From: Dave Chinner <david@fromorbit.com>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>
Cc: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 RESEND 4/5] fstests: btrfs: Add per inode dedup flag test
Date: Mon, 29 Feb 2016 09:39:17 +1100 [thread overview]
Message-ID: <20160228223917.GC29057@dastard> (raw)
In-Reply-To: <1456301196-15874-5-git-send-email-quwenruo@cn.fujitsu.com>
On Wed, Feb 24, 2016 at 04:06:35PM +0800, Qu Wenruo wrote:
> +# 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 ))
> +dedup_bs=$(( 64 * 1024 ))
256m, 64k.
> +_scratch_mkfs "-O dedup" >> $seqres.full 2>&1
> +_scratch_mount
> +
> +# Return 0 for not deduped at all , return 1 for part or full deduped
> +test_file_deduped () {
> + file=$1
> +
echo -n "$file: "
> + nr_uniq_extents=$(_uniq_extent_count $file)
> + nr_total_extents=$(_extent_count $file)
> +
> + if [ $nr_uniq_extents -eq $nr_total_extents ]; then
> + echo "not de-duplicated"
> + else
> + echo "de-duplicated"
> + fi
> +}
> +
> +dedup_write_file () {
> + file=$1
> + size=$2
> +
> + $XFS_IO_PROG -f -c "pwrite -b $dedup_bs 0 $size" $file | _filter_xfs_io
> +}
> +
> +print_result () {
> + file=$1
> +
> + echo "$(basename $file): $(test_file_deduped $file)"
> +}
> +_run_btrfs_util_prog dedup enable -b $dedup_bs $SCRATCH_MNT
> +touch $SCRATCH_MNT/dedup_file
> +touch $SCRATCH_MNT/no_dedup_file
> +mkdir $SCRATCH_MNT/dedup_dir
> +mkdir $SCRATCH_MNT/no_dedup_dir
> +
> +_run_btrfs_util_prog property set $SCRATCH_MNT/no_dedup_file dedup disable
> +_run_btrfs_util_prog property set $SCRATCH_MNT/no_dedup_dir dedup disable
> +
> +dedup_write_file $SCRATCH_MNT/tmp $dedup_bs
Just call xfs_io directly - wrapper is not necessary for a single
line command.
> +# sync to ensure hash is added to dedup tree
> +sync
> +
> +dedup_write_file $SCRATCH_MNT/dedup_file $file_size
> +dedup_write_file $SCRATCH_MNT/no_dedup_file $file_size
> +dedup_write_file $SCRATCH_MNT/dedup_dir/dedup_dir_default_file $file_size
> +dedup_write_file $SCRATCH_MNT/no_dedup_dir/no_dedup_dir_default_file $file_size
> +
> +print_result $SCRATCH_MNT/dedup_file
test_file_deduped $SCRATCH_MNT/dedup_file | _filter_scratch
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2016-02-28 22:39 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
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 [this message]
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=20160228223917.GC29057@dastard \
--to=david@fromorbit.com \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo@cn.fujitsu.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 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.