btrfs/022: Match qgroup id more correctly
authorQu Wenruo <wqu@suse.com>
Fri, 7 Feb 2020 01:59:41 +0000 (09:59 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 9 Feb 2020 15:56:09 +0000 (23:56 +0800)
commit9e2be2b1330bfad0cd95bddae3baadb5fb73ff8a
treefcdd898a28c164233e39b0c7dfb59d93498913f4
parentf41020d7f026a88767bee590cc698cec9ec0b155
btrfs/022: Match qgroup id more correctly

[BUG]
Btrfs/022 sometimes fails with snapshot's reference mismatch with its
source.

[CAUSE]
Since commit fd0830929573 ("fsstress: add the ability to create
snapshots") adds the ability for fsstress to create/delete snapshot and
subvolumes, fsstress will create new subvolumes under test dir.

For example, we could have the following subvolumes created by fsstress:
subvol a id=256
subvol b id=306
qgroupid         rfer         excl
--------         ----         ----
0/5             16384        16384
0/256        13914112        16384
...
0/263         3080192      2306048  << 2 *306* 048
...
0/306        13914112        16384  << 0/ *306

So when we're greping for subvolid 306, it matches qgroup 0/263 first,
which has difference size, and caused false alert.

[FIX]
Instead of greping "$subvolid" blindly, now grep "0/$subvolid" to catch
qgroupid correctly, without hitting rfer/excl values.

Suggested-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/btrfs/022