From: Mark Fasheh <mfasheh@suse.de>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>
Cc: linux-btrfs@vger.kernel.org, David Sterba <dsterba@suse.com>,
Josef Bacik <jbacik@fb.com>
Subject: Re: [PATCH] Improve balance performance when qgroups are turned on
Date: Tue, 31 May 2016 17:50:08 -0700 [thread overview]
Message-ID: <20160601005008.GD7633@wotan.suse.de> (raw)
In-Reply-To: <f65fce82-4985-8fc5-604d-399fbc7b5e3c@cn.fujitsu.com>
On Mon, May 30, 2016 at 03:48:14PM +0800, Qu Wenruo wrote:
>
>
> Mark Fasheh wrote on 2016/05/26 17:18 -0700:
> >The btrfs balance operation is significantly slower when qgroups are
> >enabled. To the best of my knowledge, a balance shouldn't have an effect on
> >qgroups counts (extents are not changing between subvolumes), so we don't
> >need to actually run the qgroup code when we balance.
>
> This assumption is questionable.
>
> When balancing, it's true we will set the chunk to ro, so new
> *allocation* won't happen in that chunk.
>
> However we can still de-refer an extent during balance.
>
> If that happens and we skipped the qgroup accounting, corruption happens.
> As the extent before and after balance won't go through qgroup, so
> it's de-reference won't be accounted.
Ok, thanks for the review. I was afraid that this was the case.
> While without your patch, the final qgroup is stable with 16KiB.
Qgroups in general are broken with respect to balance. The following script
reproduces an inconsistency every time I run it. You'll notice that qgroups
aren't even turned on until before we do the balance op. Like the snap
create bug, I believe you simply need a non-trivial amount of data on the fs
for testing.
#!/bin/bash -x
MNT="/btrfs"
DEV="/dev/vdb1"
mkfs.btrfs -f $DEV
mount -t btrfs $DEV $MNT
mkdir $MNT/snaps
echo "populate $MNT with some data"
#cp -a /usr/share/fonts $MNT/
cp -a /usr/ $MNT/ &
for i in `seq -w 0 8`; do
S="$MNT/snaps/snap$i"
echo "create and populate $S"
btrfs su snap $MNT $S;
cp -a /boot $S;
done;
#let the cp from above finish
wait
btrfs fi sync $MNT
btrfs quota enable $MNT
btrfs quota rescan -w $MNT
btrfs qg show $MNT
umount $MNT
mount -t btrfs $DEV $MNT
time btrfs balance start --full-balance $MNT
umount $MNT
btrfsck $DEV
> The xfstest case will follow soon.
Ok, that will help the next time someone tries to fix this, thanks.
--Mark
--
Mark Fasheh
next prev parent reply other threads:[~2016-06-01 0:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-27 0:18 [PATCH] Improve balance performance when qgroups are turned on Mark Fasheh
2016-05-30 7:48 ` Qu Wenruo
2016-06-01 0:50 ` Mark Fasheh [this message]
2016-06-01 1:31 ` Qu Wenruo
2016-06-01 5:38 ` Mark Fasheh
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=20160601005008.GD7633@wotan.suse.de \
--to=mfasheh@suse.de \
--cc=dsterba@suse.com \
--cc=jbacik@fb.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox