FS/XFS testing framework
 help / color / mirror / Atom feed
* [PATCH] xfstests: btrfs/080 add test case for qgroup account on shared extents
@ 2014-12-16  9:43 Liu Bo
  2014-12-16 12:10 ` Eryu Guan
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Liu Bo @ 2014-12-16  9:43 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

This is a regression test of
'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'

It can produce qgroup related warnings.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 tests/btrfs/080     | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/080.out |  3 +++
 2 files changed, 76 insertions(+)
 create mode 100755 tests/btrfs/080
 create mode 100644 tests/btrfs/080.out

diff --git a/tests/btrfs/080 b/tests/btrfs/080
new file mode 100755
index 0000000..2a12bf2
--- /dev/null
+++ b/tests/btrfs/080
@@ -0,0 +1,73 @@
+#! /bin/bash
+# FS QA Test No. 080
+#
+# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'
+# this will throw a warning into dmesg.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014 Liu Bo.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    cd /
+    rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+
+_need_to_be_root
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+
+run_check _scratch_mkfs "-b 1g --nodesize 4096"
+run_check _scratch_mount
+
+run_check xfs_io -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo
+
+_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
+
+run_check cp --reflink $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
+run_check cp --reflink $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
+run_check cp --reflink $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2
+
+_run_btrfs_util_prog quota enable $SCRATCH_MNT
+_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
+
+rm -fr $SCRATCH_MNT/* >& /dev/null
+
+_run_btrfs_util_prog filesystem sync $SCRATCH_MNT
+
+$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $SED_PROG -n '/[0-9]/p' | $AWK_PROG '{print $2" "$3}'
+
+# success, all done
+status=0
+exit
diff --git a/tests/btrfs/080.out b/tests/btrfs/080.out
new file mode 100644
index 0000000..eafa7c3
--- /dev/null
+++ b/tests/btrfs/080.out
@@ -0,0 +1,3 @@
+QA output created by 080
+4096 4096
+4096 4096
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] xfstests: btrfs/080 add test case for qgroup account on shared extents
  2014-12-16  9:43 [PATCH] xfstests: btrfs/080 add test case for qgroup account on shared extents Liu Bo
@ 2014-12-16 12:10 ` Eryu Guan
  2014-12-17  3:12   ` Satoru Takeuchi
  2014-12-17  3:36   ` Liu Bo
  2014-12-17  3:45 ` [PATCH] xfstests: btrfs: " Liu Bo
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 17+ messages in thread
From: Eryu Guan @ 2014-12-16 12:10 UTC (permalink / raw)
  To: Liu Bo; +Cc: fstests, linux-btrfs

On Tue, Dec 16, 2014 at 05:43:24PM +0800, Liu Bo wrote:
> This is a regression test of
> 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'
> 
> It can produce qgroup related warnings.
> 
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>

I have trouble applying the patch, can you please take a look?

patch: **** malformed patch at line 83: diff --git a/tests/btrfs/080.out b/tests/btrfs/080.out

And for new test case, "btrfs: add test case for qgroup ..." is good
enough, the seq number may be changed in future.

Some comments inline by looking at the patch.

> ---
>  tests/btrfs/080     | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/080.out |  3 +++
>  2 files changed, 76 insertions(+)
>  create mode 100755 tests/btrfs/080
>  create mode 100644 tests/btrfs/080.out

You need to add test description to tests/btrfs/group too. And you can
use the first unused seq number, I think it's 017 now.

> 
> diff --git a/tests/btrfs/080 b/tests/btrfs/080
> new file mode 100755
> index 0000000..2a12bf2
> --- /dev/null
> +++ b/tests/btrfs/080
> @@ -0,0 +1,73 @@
> +#! /bin/bash
> +# FS QA Test No. 080
> +#
> +# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'
> +# this will throw a warning into dmesg.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2014 Liu Bo.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#-----------------------------------------------------------------------
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1	# failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +    cd /
> +    rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +
> +_need_to_be_root
> +_supported_fs btrfs
> +_supported_os Linux
> +_require_scratch
> +
> +run_check _scratch_mkfs "-b 1g --nodesize 4096"
> +run_check _scratch_mount

I'm not sure if we need run_check here, I'll look at it again when I
can run the test.

> +
> +run_check xfs_io -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo

Use $XFS_IO_PROG here, which adds "-F" option if fs is not xfs.

> +
> +_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
> +
> +run_check cp --reflink $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
> +run_check cp --reflink $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
> +run_check cp --reflink $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2

Need _require_cp_reflink first.

> +
> +_run_btrfs_util_prog quota enable $SCRATCH_MNT
> +_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
> +
> +rm -fr $SCRATCH_MNT/* >& /dev/null

I prefer "rm -fr $SCRATCH_MNT/* >/dev/null 2>&1"

But we use /bin/bash for all fstests tests, >& can work too..

> +
> +_run_btrfs_util_prog filesystem sync $SCRATCH_MNT
> +
> +$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $SED_PROG -n '/[0-9]/p' | $AWK_PROG '{print $2" "$3}'

Will dmesg log be checked? As the test will trigger warnings in dmesg, I
assume that's how the test determine pass/fail.

Thanks,
Eryu
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/btrfs/080.out b/tests/btrfs/080.out
> new file mode 100644
> index 0000000..eafa7c3
> --- /dev/null
> +++ b/tests/btrfs/080.out
> @@ -0,0 +1,3 @@
> +QA output created by 080
> +4096 4096
> +4096 4096
> -- 
> 1.8.2.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] xfstests: btrfs/080 add test case for qgroup account on shared extents
  2014-12-16 12:10 ` Eryu Guan
@ 2014-12-17  3:12   ` Satoru Takeuchi
  2014-12-17  3:38     ` Liu Bo
  2014-12-17  3:36   ` Liu Bo
  1 sibling, 1 reply; 17+ messages in thread
From: Satoru Takeuchi @ 2014-12-17  3:12 UTC (permalink / raw)
  To: Eryu Guan, Liu Bo; +Cc: fstests, linux-btrfs

Hi Liu,

(2014/12/16 21:10), Eryu Guan wrote:
> On Tue, Dec 16, 2014 at 05:43:24PM +0800, Liu Bo wrote:
>> This is a regression test of
>> 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'
>>
>> It can produce qgroup related warnings.
>>
>> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
>
> I have trouble applying the patch, can you please take a look?
>
> patch: **** malformed patch at line 83: diff --git a/tests/btrfs/080.out b/tests/btrfs/080.out

In addition, although you mark this test as tests/btrfs/080,
this name is already used by other test which Filipe added
at commit 0cfb617c51ae, yesterday.

Just FYI, tests/btrfs/081 is also exists in the newest xfstests...

Thanks,
Satoru

>
> And for new test case, "btrfs: add test case for qgroup ..." is good
> enough, the seq number may be changed in future.
>
> Some comments inline by looking at the patch.
>
>> ---
>>   tests/btrfs/080     | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>>   tests/btrfs/080.out |  3 +++
>>   2 files changed, 76 insertions(+)
>>   create mode 100755 tests/btrfs/080
>>   create mode 100644 tests/btrfs/080.out
>
> You need to add test description to tests/btrfs/group too. And you can
> use the first unused seq number, I think it's 017 now.
>
>>
>> diff --git a/tests/btrfs/080 b/tests/btrfs/080
>> new file mode 100755
>> index 0000000..2a12bf2
>> --- /dev/null
>> +++ b/tests/btrfs/080
>> @@ -0,0 +1,73 @@
>> +#! /bin/bash
>> +# FS QA Test No. 080
>> +#
>> +# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'
>> +# this will throw a warning into dmesg.
>> +#
>> +#-----------------------------------------------------------------------
>> +# Copyright (c) 2014 Liu Bo.  All Rights Reserved.
>> +#
>> +# This program is free software; you can redistribute it and/or
>> +# modify it under the terms of the GNU General Public License as
>> +# published by the Free Software Foundation.
>> +#
>> +# This program is distributed in the hope that it would be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> +# GNU General Public License for more details.
>> +#-----------------------------------------------------------------------
>> +#
>> +
>> +seq=`basename $0`
>> +seqres=$RESULT_DIR/$seq
>> +echo "QA output created by $seq"
>> +
>> +here=`pwd`
>> +tmp=/tmp/$$
>> +status=1	# failure is the default!
>> +trap "_cleanup; exit \$status" 0 1 2 3 15
>> +
>> +_cleanup()
>> +{
>> +    cd /
>> +    rm -f $tmp.*
>> +}
>> +
>> +# get standard environment, filters and checks
>> +. ./common/rc
>> +. ./common/filter
>> +
>> +# real QA test starts here
>> +
>> +_need_to_be_root
>> +_supported_fs btrfs
>> +_supported_os Linux
>> +_require_scratch
>> +
>> +run_check _scratch_mkfs "-b 1g --nodesize 4096"
>> +run_check _scratch_mount
>
> I'm not sure if we need run_check here, I'll look at it again when I
> can run the test.
>
>> +
>> +run_check xfs_io -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo
>
> Use $XFS_IO_PROG here, which adds "-F" option if fs is not xfs.
>
>> +
>> +_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
>> +
>> +run_check cp --reflink $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
>> +run_check cp --reflink $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
>> +run_check cp --reflink $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2
>
> Need _require_cp_reflink first.
>
>> +
>> +_run_btrfs_util_prog quota enable $SCRATCH_MNT
>> +_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
>> +
>> +rm -fr $SCRATCH_MNT/* >& /dev/null
>
> I prefer "rm -fr $SCRATCH_MNT/* >/dev/null 2>&1"
>
> But we use /bin/bash for all fstests tests, >& can work too..
>
>> +
>> +_run_btrfs_util_prog filesystem sync $SCRATCH_MNT
>> +
>> +$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $SED_PROG -n '/[0-9]/p' | $AWK_PROG '{print $2" "$3}'
>
> Will dmesg log be checked? As the test will trigger warnings in dmesg, I
> assume that's how the test determine pass/fail.
>
> Thanks,
> Eryu
>> +
>> +# success, all done
>> +status=0
>> +exit
>> diff --git a/tests/btrfs/080.out b/tests/btrfs/080.out
>> new file mode 100644
>> index 0000000..eafa7c3
>> --- /dev/null
>> +++ b/tests/btrfs/080.out
>> @@ -0,0 +1,3 @@
>> +QA output created by 080
>> +4096 4096
>> +4096 4096
>> --
>> 1.8.2.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe fstests" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] xfstests: btrfs/080 add test case for qgroup account on shared extents
  2014-12-16 12:10 ` Eryu Guan
  2014-12-17  3:12   ` Satoru Takeuchi
@ 2014-12-17  3:36   ` Liu Bo
  1 sibling, 0 replies; 17+ messages in thread
From: Liu Bo @ 2014-12-17  3:36 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, linux-btrfs

Hi Guan,

On Tue, Dec 16, 2014 at 08:10:43PM +0800, Eryu Guan wrote:
> On Tue, Dec 16, 2014 at 05:43:24PM +0800, Liu Bo wrote:
> > This is a regression test of
> > 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'
> > 
> > It can produce qgroup related warnings.
> > 
> > Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> 
> I have trouble applying the patch, can you please take a look?
> 
> patch: **** malformed patch at line 83: diff --git a/tests/btrfs/080.out b/tests/btrfs/080.out

Sorry for the trouble, I've rebased this onto the latest xfstests,
please try again.

> 
> And for new test case, "btrfs: add test case for qgroup ..." is good
> enough, the seq number may be changed in future.

That's right.

> 
> Some comments inline by looking at the patch.
> 
> > ---
> >  tests/btrfs/080     | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/btrfs/080.out |  3 +++
> >  2 files changed, 76 insertions(+)
> >  create mode 100755 tests/btrfs/080
> >  create mode 100644 tests/btrfs/080.out
> 
> You need to add test description to tests/btrfs/group too. And you can
> use the first unused seq number, I think it's 017 now.
> 
> > 
> > diff --git a/tests/btrfs/080 b/tests/btrfs/080
> > new file mode 100755
> > index 0000000..2a12bf2
> > --- /dev/null
> > +++ b/tests/btrfs/080
> > @@ -0,0 +1,73 @@
> > +#! /bin/bash
> > +# FS QA Test No. 080
> > +#
> > +# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'
> > +# this will throw a warning into dmesg.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2014 Liu Bo.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#-----------------------------------------------------------------------
> > +#
> > +
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1	# failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +    cd /
> > +    rm -f $tmp.*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +
> > +_need_to_be_root
> > +_supported_fs btrfs
> > +_supported_os Linux
> > +_require_scratch
> > +
> > +run_check _scratch_mkfs "-b 1g --nodesize 4096"
> > +run_check _scratch_mount
> 
> I'm not sure if we need run_check here, I'll look at it again when I
> can run the test.
> 
> > +
> > +run_check xfs_io -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo
> 
> Use $XFS_IO_PROG here, which adds "-F" option if fs is not xfs.
> 
> > +
> > +_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
> > +
> > +run_check cp --reflink $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
> > +run_check cp --reflink $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
> > +run_check cp --reflink $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2
> 
> Need _require_cp_reflink first.

I'm going to use cloner instead as all I want is to create shared extents.

> 
> > +
> > +_run_btrfs_util_prog quota enable $SCRATCH_MNT
> > +_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
> > +
> > +rm -fr $SCRATCH_MNT/* >& /dev/null
> 
> I prefer "rm -fr $SCRATCH_MNT/* >/dev/null 2>&1"
> 
> But we use /bin/bash for all fstests tests, >& can work too..
> 
> > +
> > +_run_btrfs_util_prog filesystem sync $SCRATCH_MNT
> > +
> > +$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $SED_PROG -n '/[0-9]/p' | $AWK_PROG '{print $2" "$3}'
> 
> Will dmesg log be checked? As the test will trigger warnings in dmesg, I
> assume that's how the test determine pass/fail.

Well, the 'xx.out' has the expected qgroup number, which can help us
determine "pass/fail".

Thanks for the comments.

Thanks,

-liubo

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] xfstests: btrfs/080 add test case for qgroup account on shared extents
  2014-12-17  3:12   ` Satoru Takeuchi
@ 2014-12-17  3:38     ` Liu Bo
  0 siblings, 0 replies; 17+ messages in thread
From: Liu Bo @ 2014-12-17  3:38 UTC (permalink / raw)
  To: Satoru Takeuchi; +Cc: Eryu Guan, fstests, linux-btrfs

Hi Satoru san,

On Wed, Dec 17, 2014 at 12:12:05PM +0900, Satoru Takeuchi wrote:
> Hi Liu,
> 
> (2014/12/16 21:10), Eryu Guan wrote:
> >On Tue, Dec 16, 2014 at 05:43:24PM +0800, Liu Bo wrote:
> >>This is a regression test of
> >>'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'
> >>
> >>It can produce qgroup related warnings.
> >>
> >>Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> >
> >I have trouble applying the patch, can you please take a look?
> >
> >patch: **** malformed patch at line 83: diff --git a/tests/btrfs/080.out b/tests/btrfs/080.out
> 
> In addition, although you mark this test as tests/btrfs/080,
> this name is already used by other test which Filipe added
> at commit 0cfb617c51ae, yesterday.
> 
> Just FYI, tests/btrfs/081 is also exists in the newest xfstests...

Yeah, that's right, I've rebased onto the lastest xfstests, and the script "new" finds that btrfs/017 is the right one.

Thanks,

-liubo

> 
> Thanks,
> Satoru
> 
> >
> >And for new test case, "btrfs: add test case for qgroup ..." is good
> >enough, the seq number may be changed in future.
> >
> >Some comments inline by looking at the patch.
> >
> >>---
> >>  tests/btrfs/080     | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >>  tests/btrfs/080.out |  3 +++
> >>  2 files changed, 76 insertions(+)
> >>  create mode 100755 tests/btrfs/080
> >>  create mode 100644 tests/btrfs/080.out
> >
> >You need to add test description to tests/btrfs/group too. And you can
> >use the first unused seq number, I think it's 017 now.
> >
> >>
> >>diff --git a/tests/btrfs/080 b/tests/btrfs/080
> >>new file mode 100755
> >>index 0000000..2a12bf2
> >>--- /dev/null
> >>+++ b/tests/btrfs/080
> >>@@ -0,0 +1,73 @@
> >>+#! /bin/bash
> >>+# FS QA Test No. 080
> >>+#
> >>+# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'
> >>+# this will throw a warning into dmesg.
> >>+#
> >>+#-----------------------------------------------------------------------
> >>+# Copyright (c) 2014 Liu Bo.  All Rights Reserved.
> >>+#
> >>+# This program is free software; you can redistribute it and/or
> >>+# modify it under the terms of the GNU General Public License as
> >>+# published by the Free Software Foundation.
> >>+#
> >>+# This program is distributed in the hope that it would be useful,
> >>+# but WITHOUT ANY WARRANTY; without even the implied warranty of
> >>+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> >>+# GNU General Public License for more details.
> >>+#-----------------------------------------------------------------------
> >>+#
> >>+
> >>+seq=`basename $0`
> >>+seqres=$RESULT_DIR/$seq
> >>+echo "QA output created by $seq"
> >>+
> >>+here=`pwd`
> >>+tmp=/tmp/$$
> >>+status=1	# failure is the default!
> >>+trap "_cleanup; exit \$status" 0 1 2 3 15
> >>+
> >>+_cleanup()
> >>+{
> >>+    cd /
> >>+    rm -f $tmp.*
> >>+}
> >>+
> >>+# get standard environment, filters and checks
> >>+. ./common/rc
> >>+. ./common/filter
> >>+
> >>+# real QA test starts here
> >>+
> >>+_need_to_be_root
> >>+_supported_fs btrfs
> >>+_supported_os Linux
> >>+_require_scratch
> >>+
> >>+run_check _scratch_mkfs "-b 1g --nodesize 4096"
> >>+run_check _scratch_mount
> >
> >I'm not sure if we need run_check here, I'll look at it again when I
> >can run the test.
> >
> >>+
> >>+run_check xfs_io -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo
> >
> >Use $XFS_IO_PROG here, which adds "-F" option if fs is not xfs.
> >
> >>+
> >>+_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
> >>+
> >>+run_check cp --reflink $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
> >>+run_check cp --reflink $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
> >>+run_check cp --reflink $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2
> >
> >Need _require_cp_reflink first.
> >
> >>+
> >>+_run_btrfs_util_prog quota enable $SCRATCH_MNT
> >>+_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
> >>+
> >>+rm -fr $SCRATCH_MNT/* >& /dev/null
> >
> >I prefer "rm -fr $SCRATCH_MNT/* >/dev/null 2>&1"
> >
> >But we use /bin/bash for all fstests tests, >& can work too..
> >
> >>+
> >>+_run_btrfs_util_prog filesystem sync $SCRATCH_MNT
> >>+
> >>+$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $SED_PROG -n '/[0-9]/p' | $AWK_PROG '{print $2" "$3}'
> >
> >Will dmesg log be checked? As the test will trigger warnings in dmesg, I
> >assume that's how the test determine pass/fail.
> >
> >Thanks,
> >Eryu
> >>+
> >>+# success, all done
> >>+status=0
> >>+exit
> >>diff --git a/tests/btrfs/080.out b/tests/btrfs/080.out
> >>new file mode 100644
> >>index 0000000..eafa7c3
> >>--- /dev/null
> >>+++ b/tests/btrfs/080.out
> >>@@ -0,0 +1,3 @@
> >>+QA output created by 080
> >>+4096 4096
> >>+4096 4096
> >>--
> >>1.8.2.1
> >>
> >>--
> >>To unsubscribe from this list: send the line "unsubscribe fstests" in
> >>the body of a message to majordomo@vger.kernel.org
> >>More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >--
> >To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> >the body of a message to majordomo@vger.kernel.org
> >More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH] xfstests: btrfs: add test case for qgroup account on shared extents
  2014-12-16  9:43 [PATCH] xfstests: btrfs/080 add test case for qgroup account on shared extents Liu Bo
  2014-12-16 12:10 ` Eryu Guan
@ 2014-12-17  3:45 ` Liu Bo
  2014-12-17  3:51 ` [PATCH v2] " Liu Bo
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 17+ messages in thread
From: Liu Bo @ 2014-12-17  3:45 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

This is a regression test of
'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'

It can produce qgroup related warnings.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 tests/btrfs/017     | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/017.out |  3 +++
 tests/btrfs/group   |  1 +
 3 files changed, 78 insertions(+)
 create mode 100755 tests/btrfs/017
 create mode 100644 tests/btrfs/017.out

diff --git a/tests/btrfs/017 b/tests/btrfs/017
new file mode 100755
index 0000000..fc0e671
--- /dev/null
+++ b/tests/btrfs/017
@@ -0,0 +1,74 @@
+#! /bin/bash
+# FS QA Test No. 017
+#
+# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
+# this will throw a warning into dmesg.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014 Liu Bo.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    cd /
+    rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+
+_need_to_be_root
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_cloner
+ 
+run_check _scratch_mkfs "-b 1g --nodesize 4096"
+run_check _scratch_mount
+
+run_check $XFS_IO_PROG -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo
+
+_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
+
+run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
+run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
+run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2
+
+_run_btrfs_util_prog quota enable $SCRATCH_MNT
+_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
+
+rm -fr $SCRATCH_MNT/* >/dev/null 2>&1
+
+_run_btrfs_util_prog filesystem sync $SCRATCH_MNT
+
+$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $SED_PROG -n '/[0-9]/p' | $AWK_PROG '{print $2" "$3}'
+
+# success, all done
+status=0
+exit
diff --git a/tests/btrfs/017.out b/tests/btrfs/017.out
new file mode 100644
index 0000000..e25e631
--- /dev/null
+++ b/tests/btrfs/017.out
@@ -0,0 +1,3 @@
+QA output created by 017
+4096 4096
+4096 4096
diff --git a/tests/btrfs/group b/tests/btrfs/group
index abb2fe4..e29999b 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -19,6 +19,7 @@
 014 auto balance
 015 auto quick snapshot
 016 auto quick send
+017 auto quick qgroup
 018 auto quick subvol
 019 auto quick send
 020 auto quick replace
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2] xfstests: btrfs: add test case for qgroup account on shared extents
  2014-12-16  9:43 [PATCH] xfstests: btrfs/080 add test case for qgroup account on shared extents Liu Bo
  2014-12-16 12:10 ` Eryu Guan
  2014-12-17  3:45 ` [PATCH] xfstests: btrfs: " Liu Bo
@ 2014-12-17  3:51 ` Liu Bo
  2014-12-17  5:25   ` Eryu Guan
  2014-12-17  8:30 ` [PATCH v3] " Liu Bo
  2014-12-19  8:31 ` [PATCH v4] " Liu Bo
  4 siblings, 1 reply; 17+ messages in thread
From: Liu Bo @ 2014-12-17  3:51 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

This is a regression test of
'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'

It can produce qgroup related warnings.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
v2: - use new seq number 017 instead 080
    - use 'cloner' to get shared extents
    - use XFS_IO_PROG instead

 tests/btrfs/017     | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/017.out |  3 +++
 tests/btrfs/group   |  1 +
 3 files changed, 78 insertions(+)
 create mode 100755 tests/btrfs/017
 create mode 100644 tests/btrfs/017.out

diff --git a/tests/btrfs/017 b/tests/btrfs/017
new file mode 100755
index 0000000..fc0e671
--- /dev/null
+++ b/tests/btrfs/017
@@ -0,0 +1,74 @@
+#! /bin/bash
+# FS QA Test No. 017
+#
+# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
+# this will throw a warning into dmesg.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014 Liu Bo.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    cd /
+    rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+
+_need_to_be_root
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_cloner
+ 
+run_check _scratch_mkfs "-b 1g --nodesize 4096"
+run_check _scratch_mount
+
+run_check $XFS_IO_PROG -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo
+
+_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
+
+run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
+run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
+run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2
+
+_run_btrfs_util_prog quota enable $SCRATCH_MNT
+_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
+
+rm -fr $SCRATCH_MNT/* >/dev/null 2>&1
+
+_run_btrfs_util_prog filesystem sync $SCRATCH_MNT
+
+$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $SED_PROG -n '/[0-9]/p' | $AWK_PROG '{print $2" "$3}'
+
+# success, all done
+status=0
+exit
diff --git a/tests/btrfs/017.out b/tests/btrfs/017.out
new file mode 100644
index 0000000..e25e631
--- /dev/null
+++ b/tests/btrfs/017.out
@@ -0,0 +1,3 @@
+QA output created by 017
+4096 4096
+4096 4096
diff --git a/tests/btrfs/group b/tests/btrfs/group
index abb2fe4..e29999b 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -19,6 +19,7 @@
 014 auto balance
 015 auto quick snapshot
 016 auto quick send
+017 auto quick qgroup
 018 auto quick subvol
 019 auto quick send
 020 auto quick replace
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v2] xfstests: btrfs: add test case for qgroup account on shared extents
  2014-12-17  3:51 ` [PATCH v2] " Liu Bo
@ 2014-12-17  5:25   ` Eryu Guan
  2014-12-17  8:13     ` Liu Bo
  2014-12-17  8:24     ` Liu Bo
  0 siblings, 2 replies; 17+ messages in thread
From: Eryu Guan @ 2014-12-17  5:25 UTC (permalink / raw)
  To: Liu Bo; +Cc: fstests, linux-btrfs

On Wed, Dec 17, 2014 at 11:51:08AM +0800, Liu Bo wrote:
> This is a regression test of
> 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'
> 
> It can produce qgroup related warnings.

The commit is in kernel since May 13, but I still saw warnings on
3.18+ kernel and test fails too. Is this expected?

> 
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> ---
> v2: - use new seq number 017 instead 080
>     - use 'cloner' to get shared extents
>     - use XFS_IO_PROG instead
> 
>  tests/btrfs/017     | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/017.out |  3 +++
>  tests/btrfs/group   |  1 +
>  3 files changed, 78 insertions(+)
>  create mode 100755 tests/btrfs/017
>  create mode 100644 tests/btrfs/017.out
> 
> diff --git a/tests/btrfs/017 b/tests/btrfs/017
> new file mode 100755
> index 0000000..fc0e671
> --- /dev/null
> +++ b/tests/btrfs/017
> @@ -0,0 +1,74 @@
> +#! /bin/bash
> +# FS QA Test No. 017
> +#
> +# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
> +# this will throw a warning into dmesg.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2014 Liu Bo.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1	# failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +    cd /
> +    rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +
> +_need_to_be_root
> +_supported_fs btrfs
> +_supported_os Linux
> +_require_scratch
> +_require_cloner
> + 

Trailing whitespace here.

> +run_check _scratch_mkfs "-b 1g --nodesize 4096"

Usually this can be done by _scratch_mkfs_sized, but it doesn't accept
additional mkfs options, given that usually scratch dev is bigger than
1G, so I think using _scratch_mkfs is fine here.

> +run_check _scratch_mount
> +
> +run_check $XFS_IO_PROG -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo
> +
> +_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
> +
> +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
> +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
> +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2
> +
> +_run_btrfs_util_prog quota enable $SCRATCH_MNT
> +_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
> +
> +rm -fr $SCRATCH_MNT/* >/dev/null 2>&1
> +
> +_run_btrfs_util_prog filesystem sync $SCRATCH_MNT
> +
> +$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $SED_PROG -n '/[0-9]/p' | $AWK_PROG '{print $2" "$3}'

It'd be better to add some comments to explain the test steps, the
kernel commit is big and it's not obvious to me why these magic
steps could trigger kernel warning :)

Anyway,

Reviewed-by: Eryu Guan <eguan@redhat.com>

Thanks,
Eryu
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/btrfs/017.out b/tests/btrfs/017.out
> new file mode 100644
> index 0000000..e25e631
> --- /dev/null
> +++ b/tests/btrfs/017.out
> @@ -0,0 +1,3 @@
> +QA output created by 017
> +4096 4096
> +4096 4096
> diff --git a/tests/btrfs/group b/tests/btrfs/group
> index abb2fe4..e29999b 100644
> --- a/tests/btrfs/group
> +++ b/tests/btrfs/group
> @@ -19,6 +19,7 @@
>  014 auto balance
>  015 auto quick snapshot
>  016 auto quick send
> +017 auto quick qgroup
>  018 auto quick subvol
>  019 auto quick send
>  020 auto quick replace
> -- 
> 1.8.2.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2] xfstests: btrfs: add test case for qgroup account on shared extents
  2014-12-17  5:25   ` Eryu Guan
@ 2014-12-17  8:13     ` Liu Bo
  2014-12-17  8:24     ` Liu Bo
  1 sibling, 0 replies; 17+ messages in thread
From: Liu Bo @ 2014-12-17  8:13 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, linux-btrfs

On Wed, Dec 17, 2014 at 01:25:31PM +0800, Eryu Guan wrote:
> On Wed, Dec 17, 2014 at 11:51:08AM +0800, Liu Bo wrote:
> > This is a regression test of
> > 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'
> > 
> > It can produce qgroup related warnings.
> 
> The commit is in kernel since May 13, but I still saw warnings on
> 3.18+ kernel and test fails too. Is this expected?

Yes, I just sent the fix,

Btrfs: fix a warning of qgroup account on shared extents
https://patchwork.kernel.org/patch/5499981/

> 
> > 
> > Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> > ---
> > v2: - use new seq number 017 instead 080
> >     - use 'cloner' to get shared extents
> >     - use XFS_IO_PROG instead
> > 
> >  tests/btrfs/017     | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/btrfs/017.out |  3 +++
> >  tests/btrfs/group   |  1 +
> >  3 files changed, 78 insertions(+)
> >  create mode 100755 tests/btrfs/017
> >  create mode 100644 tests/btrfs/017.out
> > 
> > diff --git a/tests/btrfs/017 b/tests/btrfs/017
> > new file mode 100755
> > index 0000000..fc0e671
> > --- /dev/null
> > +++ b/tests/btrfs/017
> > @@ -0,0 +1,74 @@
> > +#! /bin/bash
> > +# FS QA Test No. 017
> > +#
> > +# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
> > +# this will throw a warning into dmesg.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2014 Liu Bo.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +#
> > +
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1	# failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +    cd /
> > +    rm -f $tmp.*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +
> > +_need_to_be_root
> > +_supported_fs btrfs
> > +_supported_os Linux
> > +_require_scratch
> > +_require_cloner
> > + 
> 
> Trailing whitespace here.
> 
> > +run_check _scratch_mkfs "-b 1g --nodesize 4096"
> 
> Usually this can be done by _scratch_mkfs_sized, but it doesn't accept
> additional mkfs options, given that usually scratch dev is bigger than
> 1G, so I think using _scratch_mkfs is fine here.
> 
> > +run_check _scratch_mount
> > +
> > +run_check $XFS_IO_PROG -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo
> > +
> > +_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
> > +
> > +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
> > +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
> > +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2
> > +
> > +_run_btrfs_util_prog quota enable $SCRATCH_MNT
> > +_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
> > +
> > +rm -fr $SCRATCH_MNT/* >/dev/null 2>&1
> > +
> > +_run_btrfs_util_prog filesystem sync $SCRATCH_MNT
> > +
> > +$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $SED_PROG -n '/[0-9]/p' | $AWK_PROG '{print $2" "$3}'
> 
> It'd be better to add some comments to explain the test steps, the
> kernel commit is big and it's not obvious to me why these magic
> steps could trigger kernel warning :)

Well, I'll add the fix link that could explain a bit.

> 
> Anyway,
> 
> Reviewed-by: Eryu Guan <eguan@redhat.com>
> 

Thanks!

-liubo

> Thanks,
> Eryu
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/btrfs/017.out b/tests/btrfs/017.out
> > new file mode 100644
> > index 0000000..e25e631
> > --- /dev/null
> > +++ b/tests/btrfs/017.out
> > @@ -0,0 +1,3 @@
> > +QA output created by 017
> > +4096 4096
> > +4096 4096
> > diff --git a/tests/btrfs/group b/tests/btrfs/group
> > index abb2fe4..e29999b 100644
> > --- a/tests/btrfs/group
> > +++ b/tests/btrfs/group
> > @@ -19,6 +19,7 @@
> >  014 auto balance
> >  015 auto quick snapshot
> >  016 auto quick send
> > +017 auto quick qgroup
> >  018 auto quick subvol
> >  019 auto quick send
> >  020 auto quick replace
> > -- 
> > 1.8.2.1
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2] xfstests: btrfs: add test case for qgroup account on shared extents
  2014-12-17  5:25   ` Eryu Guan
  2014-12-17  8:13     ` Liu Bo
@ 2014-12-17  8:24     ` Liu Bo
  1 sibling, 0 replies; 17+ messages in thread
From: Liu Bo @ 2014-12-17  8:24 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, linux-btrfs

On Wed, Dec 17, 2014 at 01:25:31PM +0800, Eryu Guan wrote:
> On Wed, Dec 17, 2014 at 11:51:08AM +0800, Liu Bo wrote:
> > This is a regression test of
> > 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'
> > 
> > It can produce qgroup related warnings.
> 
> The commit is in kernel since May 13, but I still saw warnings on
> 3.18+ kernel and test fails too. Is this expected?
> 
> > 
> > Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> > ---
> > v2: - use new seq number 017 instead 080
> >     - use 'cloner' to get shared extents
> >     - use XFS_IO_PROG instead
> > 
> >  tests/btrfs/017     | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/btrfs/017.out |  3 +++
> >  tests/btrfs/group   |  1 +
> >  3 files changed, 78 insertions(+)
> >  create mode 100755 tests/btrfs/017
> >  create mode 100644 tests/btrfs/017.out
> > 
> > diff --git a/tests/btrfs/017 b/tests/btrfs/017
> > new file mode 100755
> > index 0000000..fc0e671
> > --- /dev/null
> > +++ b/tests/btrfs/017
> > @@ -0,0 +1,74 @@
> > +#! /bin/bash
> > +# FS QA Test No. 017
> > +#
> > +# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
> > +# this will throw a warning into dmesg.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2014 Liu Bo.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +#
> > +
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1	# failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +    cd /
> > +    rm -f $tmp.*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +
> > +_need_to_be_root
> > +_supported_fs btrfs
> > +_supported_os Linux
> > +_require_scratch
> > +_require_cloner
> > + 
> 
> Trailing whitespace here.
> 
> > +run_check _scratch_mkfs "-b 1g --nodesize 4096"
> 
> Usually this can be done by _scratch_mkfs_sized, but it doesn't accept
> additional mkfs options, given that usually scratch dev is bigger than
> 1G, so I think using _scratch_mkfs is fine here.

As we need to get a stable result for "017.out", "--nodesize 4096" is
necessary while "-b 1g" is not.

Thanks,

-liubo

> 
> > +run_check _scratch_mount
> > +
> > +run_check $XFS_IO_PROG -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo
> > +
> > +_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
> > +
> > +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
> > +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
> > +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2
> > +
> > +_run_btrfs_util_prog quota enable $SCRATCH_MNT
> > +_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
> > +
> > +rm -fr $SCRATCH_MNT/* >/dev/null 2>&1
> > +
> > +_run_btrfs_util_prog filesystem sync $SCRATCH_MNT
> > +
> > +$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $SED_PROG -n '/[0-9]/p' | $AWK_PROG '{print $2" "$3}'
> 
> It'd be better to add some comments to explain the test steps, the
> kernel commit is big and it's not obvious to me why these magic
> steps could trigger kernel warning :)
> 
> Anyway,
> 
> Reviewed-by: Eryu Guan <eguan@redhat.com>
> 
> Thanks,
> Eryu
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/btrfs/017.out b/tests/btrfs/017.out
> > new file mode 100644
> > index 0000000..e25e631
> > --- /dev/null
> > +++ b/tests/btrfs/017.out
> > @@ -0,0 +1,3 @@
> > +QA output created by 017
> > +4096 4096
> > +4096 4096
> > diff --git a/tests/btrfs/group b/tests/btrfs/group
> > index abb2fe4..e29999b 100644
> > --- a/tests/btrfs/group
> > +++ b/tests/btrfs/group
> > @@ -19,6 +19,7 @@
> >  014 auto balance
> >  015 auto quick snapshot
> >  016 auto quick send
> > +017 auto quick qgroup
> >  018 auto quick subvol
> >  019 auto quick send
> >  020 auto quick replace
> > -- 
> > 1.8.2.1
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v3] xfstests: btrfs: add test case for qgroup account on shared extents
  2014-12-16  9:43 [PATCH] xfstests: btrfs/080 add test case for qgroup account on shared extents Liu Bo
                   ` (2 preceding siblings ...)
  2014-12-17  3:51 ` [PATCH v2] " Liu Bo
@ 2014-12-17  8:30 ` Liu Bo
  2014-12-17 10:00   ` Satoru Takeuchi
  2014-12-18  0:05   ` Dave Chinner
  2014-12-19  8:31 ` [PATCH v4] " Liu Bo
  4 siblings, 2 replies; 17+ messages in thread
From: Liu Bo @ 2014-12-17  8:30 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

This is a regression test of
'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'

It can produce qgroup related warnings.

The fix is https://patchwork.kernel.org/patch/5499981/
"Btrfs: fix a warning of qgroup account on shared extents"

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
---
v3: - remove trailing whilespace.
    - add the fix link for more details of the problem.

v2: - use new seq number 017 instead 080
    - use 'cloner' to get shared extents
    - use XFS_IO_PROG instead

 tests/btrfs/017     | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/017.out |  3 +++
 tests/btrfs/group   |  1 +
 3 files changed, 81 insertions(+)
 create mode 100755 tests/btrfs/017
 create mode 100644 tests/btrfs/017.out

diff --git a/tests/btrfs/017 b/tests/btrfs/017
new file mode 100755
index 0000000..b0390d5
--- /dev/null
+++ b/tests/btrfs/017
@@ -0,0 +1,77 @@
+#! /bin/bash
+# FS QA Test No. 017
+#
+# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
+# this will throw a warning into dmesg.
+#
+# For more details, the fix is https://patchwork.kernel.org/patch/5499981/
+# "Btrfs: fix a warning of qgroup account on shared extents"
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014 Liu Bo.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    cd /
+    rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+
+_need_to_be_root
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_cloner
+
+run_check _scratch_mkfs "--nodesize 4096"
+run_check _scratch_mount
+
+run_check $XFS_IO_PROG -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo
+
+_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
+
+run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
+run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
+run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2
+
+_run_btrfs_util_prog quota enable $SCRATCH_MNT
+_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
+
+rm -fr $SCRATCH_MNT/* >/dev/null 2>&1
+
+_run_btrfs_util_prog filesystem sync $SCRATCH_MNT
+
+$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $SED_PROG -n '/[0-9]/p' | $AWK_PROG '{print $2" "$3}'
+
+# success, all done
+status=0
+exit
diff --git a/tests/btrfs/017.out b/tests/btrfs/017.out
new file mode 100644
index 0000000..e25e631
--- /dev/null
+++ b/tests/btrfs/017.out
@@ -0,0 +1,3 @@
+QA output created by 017
+4096 4096
+4096 4096
diff --git a/tests/btrfs/group b/tests/btrfs/group
index abb2fe4..e29999b 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -19,6 +19,7 @@
 014 auto balance
 015 auto quick snapshot
 016 auto quick send
+017 auto quick qgroup
 018 auto quick subvol
 019 auto quick send
 020 auto quick replace
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] xfstests: btrfs: add test case for qgroup account on shared extents
  2014-12-17  8:30 ` [PATCH v3] " Liu Bo
@ 2014-12-17 10:00   ` Satoru Takeuchi
  2014-12-18  0:05   ` Dave Chinner
  1 sibling, 0 replies; 17+ messages in thread
From: Satoru Takeuchi @ 2014-12-17 10:00 UTC (permalink / raw)
  To: Liu Bo, fstests; +Cc: linux-btrfs

Hi Liu,

(2014/12/17 17:30), Liu Bo wrote:
> This is a regression test of
> 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'
> 
> It can produce qgroup related warnings.
> 
> The fix is https://patchwork.kernel.org/patch/5499981/
> "Btrfs: fix a warning of qgroup account on shared extents"
> 
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> Reviewed-by: Eryu Guan <eguan@redhat.com>

It looks good to me.

Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Tested-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>

* Test result

** The latest upstream kernel without your patch

Failed as follows.

results/btrfs/017.out.bad
===============================================================================
QA output created by 017
-4096 4096
-12288 -4096
===============================================================================

** The latest upstream kernel with your patch

Succeeded.

Thanks,
Satoru

> ---
> v3: - remove trailing whilespace.
>      - add the fix link for more details of the problem.
> 
> v2: - use new seq number 017 instead 080
>      - use 'cloner' to get shared extents
>      - use XFS_IO_PROG instead
> 
>   tests/btrfs/017     | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>   tests/btrfs/017.out |  3 +++
>   tests/btrfs/group   |  1 +
>   3 files changed, 81 insertions(+)
>   create mode 100755 tests/btrfs/017
>   create mode 100644 tests/btrfs/017.out
> 
> diff --git a/tests/btrfs/017 b/tests/btrfs/017
> new file mode 100755
> index 0000000..b0390d5
> --- /dev/null
> +++ b/tests/btrfs/017
> @@ -0,0 +1,77 @@
> +#! /bin/bash
> +# FS QA Test No. 017
> +#
> +# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
> +# this will throw a warning into dmesg.
> +#
> +# For more details, the fix is https://patchwork.kernel.org/patch/5499981/
> +# "Btrfs: fix a warning of qgroup account on shared extents"
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2014 Liu Bo.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1	# failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +    cd /
> +    rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +
> +_need_to_be_root
> +_supported_fs btrfs
> +_supported_os Linux
> +_require_scratch
> +_require_cloner
> +
> +run_check _scratch_mkfs "--nodesize 4096"
> +run_check _scratch_mount
> +
> +run_check $XFS_IO_PROG -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo
> +
> +_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
> +
> +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
> +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
> +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2
> +
> +_run_btrfs_util_prog quota enable $SCRATCH_MNT
> +_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
> +
> +rm -fr $SCRATCH_MNT/* >/dev/null 2>&1
> +
> +_run_btrfs_util_prog filesystem sync $SCRATCH_MNT
> +
> +$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $SED_PROG -n '/[0-9]/p' | $AWK_PROG '{print $2" "$3}'
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/btrfs/017.out b/tests/btrfs/017.out
> new file mode 100644
> index 0000000..e25e631
> --- /dev/null
> +++ b/tests/btrfs/017.out
> @@ -0,0 +1,3 @@
> +QA output created by 017
> +4096 4096
> +4096 4096
> diff --git a/tests/btrfs/group b/tests/btrfs/group
> index abb2fe4..e29999b 100644
> --- a/tests/btrfs/group
> +++ b/tests/btrfs/group
> @@ -19,6 +19,7 @@
>   014 auto balance
>   015 auto quick snapshot
>   016 auto quick send
> +017 auto quick qgroup
>   018 auto quick subvol
>   019 auto quick send
>   020 auto quick replace
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] xfstests: btrfs: add test case for qgroup account on shared extents
  2014-12-17  8:30 ` [PATCH v3] " Liu Bo
  2014-12-17 10:00   ` Satoru Takeuchi
@ 2014-12-18  0:05   ` Dave Chinner
  2014-12-19  8:29     ` Liu Bo
  1 sibling, 1 reply; 17+ messages in thread
From: Dave Chinner @ 2014-12-18  0:05 UTC (permalink / raw)
  To: Liu Bo; +Cc: fstests, linux-btrfs

On Wed, Dec 17, 2014 at 04:30:47PM +0800, Liu Bo wrote:
> This is a regression test of
> 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'
> 
> It can produce qgroup related warnings.
> 
> The fix is https://patchwork.kernel.org/patch/5499981/
> "Btrfs: fix a warning of qgroup account on shared extents"
....
> +#! /bin/bash
> +# FS QA Test No. 017
> +#
> +# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
> +# this will throw a warning into dmesg.
> +#
> +# For more details, the fix is https://patchwork.kernel.org/patch/5499981/
> +# "Btrfs: fix a warning of qgroup account on shared extents"

Please describe the test directly.

> +
> +_need_to_be_root
> +_supported_fs btrfs
> +_supported_os Linux
> +_require_scratch
> +_require_cloner
> +
> +run_check _scratch_mkfs "--nodesize 4096"
> +run_check _scratch_mount

No, please don't use run_check like this.

Errors will end up in the output file, and that will cause the test
to fail.

> +run_check $XFS_IO_PROG -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo

Same - filter the output, and errors will be verbose and cause a
failure.

> +
> +_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
> +
> +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
> +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
> +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2

Filter the output, not "run_check".

If CLONER_PROG is silent when it fails, then it is broken and needs
fixing because users need to know that something failed and they
don't check exit codes.

> +_run_btrfs_util_prog quota enable $SCRATCH_MNT
> +_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
> +
> +rm -fr $SCRATCH_MNT/* >/dev/null 2>&1

Don't redirect the output. If an unlink fails, we want to know about
it.

> +_run_btrfs_util_prog filesystem sync $SCRATCH_MNT

What's wrong with "sync"?

> +$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $SED_PROG -n '/[0-9]/p' | $AWK_PROG '{print $2" "$3}'

You can do regex matches with awk.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] xfstests: btrfs: add test case for qgroup account on shared extents
  2014-12-18  0:05   ` Dave Chinner
@ 2014-12-19  8:29     ` Liu Bo
  0 siblings, 0 replies; 17+ messages in thread
From: Liu Bo @ 2014-12-19  8:29 UTC (permalink / raw)
  To: Dave Chinner; +Cc: fstests, linux-btrfs

On Thu, Dec 18, 2014 at 11:05:30AM +1100, Dave Chinner wrote:
> On Wed, Dec 17, 2014 at 04:30:47PM +0800, Liu Bo wrote:
> > This is a regression test of
> > 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")'
> > 
> > It can produce qgroup related warnings.
> > 
> > The fix is https://patchwork.kernel.org/patch/5499981/
> > "Btrfs: fix a warning of qgroup account on shared extents"
> ....
> > +#! /bin/bash
> > +# FS QA Test No. 017
> > +#
> > +# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
> > +# this will throw a warning into dmesg.
> > +#
> > +# For more details, the fix is https://patchwork.kernel.org/patch/5499981/
> > +# "Btrfs: fix a warning of qgroup account on shared extents"
> 
> Please describe the test directly.
> 
> > +
> > +_need_to_be_root
> > +_supported_fs btrfs
> > +_supported_os Linux
> > +_require_scratch
> > +_require_cloner
> > +
> > +run_check _scratch_mkfs "--nodesize 4096"
> > +run_check _scratch_mount
> 
> No, please don't use run_check like this.
> 
> Errors will end up in the output file, and that will cause the test
> to fail.
> 
> > +run_check $XFS_IO_PROG -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo
> 
> Same - filter the output, and errors will be verbose and cause a
> failure.
> 
> > +
> > +_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
> > +
> > +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
> > +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
> > +run_check $CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2
> 
> Filter the output, not "run_check".
> 
> If CLONER_PROG is silent when it fails, then it is broken and needs
> fixing because users need to know that something failed and they
> don't check exit codes.
> 
> > +_run_btrfs_util_prog quota enable $SCRATCH_MNT
> > +_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
> > +
> > +rm -fr $SCRATCH_MNT/* >/dev/null 2>&1
> 
> Don't redirect the output. If an unlink fails, we want to know about
> it.
> 
> > +_run_btrfs_util_prog filesystem sync $SCRATCH_MNT
> 
> What's wrong with "sync"?
> 
> > +$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $SED_PROG -n '/[0-9]/p' | $AWK_PROG '{print $2" "$3}'
> 
> You can do regex matches with awk.

Thanks for reviewing this.

Thanks,

-liubo

> 
> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v4] xfstests: btrfs: add test case for qgroup account on shared extents
  2014-12-16  9:43 [PATCH] xfstests: btrfs/080 add test case for qgroup account on shared extents Liu Bo
                   ` (3 preceding siblings ...)
  2014-12-17  8:30 ` [PATCH v3] " Liu Bo
@ 2014-12-19  8:31 ` Liu Bo
  2014-12-19  9:21   ` Satoru Takeuchi
  4 siblings, 1 reply; 17+ messages in thread
From: Liu Bo @ 2014-12-19  8:31 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

This is a regression test of
'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
it's used to verify that removing shared extents can end up incorrect
qgroup accounting.

It can produce qgroup related warnings.

The fix is https://patchwork.kernel.org/patch/5499981/
"Btrfs: fix a warning of qgroup account on shared extents"

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Tested-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
---
v4: - remove inproper run_check macro and add filter macro for xfs_io
    - use awk's regexp directly
    - add test case description

v3: - remove trailing whilespace.
    - add the fix link for more details of the problem.

v2: - use new seq number 017 instead 080
    - use 'cloner' to get shared extents
    - use XFS_IO_PROG instead

 tests/btrfs/017     | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/017.out |  5 ++++
 tests/btrfs/group   |  1 +
 3 files changed, 88 insertions(+)
 create mode 100755 tests/btrfs/017
 create mode 100644 tests/btrfs/017.out

diff --git a/tests/btrfs/017 b/tests/btrfs/017
new file mode 100755
index 0000000..7937607
--- /dev/null
+++ b/tests/btrfs/017
@@ -0,0 +1,82 @@
+#! /bin/bash
+# FS QA Test No. 017
+#
+# Verify that removing shared extents can end up incorrect qgroup accounting.
+#
+# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
+# this will throw a warning into dmesg.
+#
+# The issue is fixed by https://patchwork.kernel.org/patch/5499981/
+# "Btrfs: fix a warning of qgroup account on shared extents"
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014 Liu Bo.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    cd /
+    rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+
+_need_to_be_root
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+_require_cloner
+
+rm -f $seqres.full
+
+_scratch_mkfs "--nodesize 4096"
+_scratch_mount
+
+$XFS_IO_PROG -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo | _filter_xfs_io
+
+_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
+
+$CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
+$CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
+$CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2
+
+_run_btrfs_util_prog quota enable $SCRATCH_MNT
+_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
+
+rm -fr $SCRATCH_MNT/foo*
+rm -fr $SCRATCH_MNT/snap/foo*
+
+sync
+
+$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $AWK_PROG '/[0-9]/ {print $2" "$3}'
+
+# success, all done
+status=0
+exit
diff --git a/tests/btrfs/017.out b/tests/btrfs/017.out
new file mode 100644
index 0000000..7658e2e
--- /dev/null
+++ b/tests/btrfs/017.out
@@ -0,0 +1,5 @@
+QA output created by 017
+wrote 8192/8192 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4096 4096
+4096 4096
diff --git a/tests/btrfs/group b/tests/btrfs/group
index abb2fe4..e29999b 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -19,6 +19,7 @@
 014 auto balance
 015 auto quick snapshot
 016 auto quick send
+017 auto quick qgroup
 018 auto quick subvol
 019 auto quick send
 020 auto quick replace
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v4] xfstests: btrfs: add test case for qgroup account on shared extents
  2014-12-19  8:31 ` [PATCH v4] " Liu Bo
@ 2014-12-19  9:21   ` Satoru Takeuchi
  2014-12-19  9:29     ` Liu Bo
  0 siblings, 1 reply; 17+ messages in thread
From: Satoru Takeuchi @ 2014-12-19  9:21 UTC (permalink / raw)
  To: Liu Bo, fstests; +Cc: linux-btrfs

Hi Liu,

On 2014/12/19 17:31, Liu Bo wrote:
> This is a regression test of
> 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
> it's used to verify that removing shared extents can end up incorrect
> qgroup accounting.
> 
> It can produce qgroup related warnings.
> 
> The fix is https://patchwork.kernel.org/patch/5499981/
> "Btrfs: fix a warning of qgroup account on shared extents"
> 
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> Tested-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>

V4 also passed my test,

Thanks,
Satoru

> Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
> Reviewed-by: Eryu Guan <eguan@redhat.com>
> ---
> v4: - remove inproper run_check macro and add filter macro for xfs_io
>      - use awk's regexp directly
>      - add test case description
> 
> v3: - remove trailing whilespace.
>      - add the fix link for more details of the problem.
> 
> v2: - use new seq number 017 instead 080
>      - use 'cloner' to get shared extents
>      - use XFS_IO_PROG instead
> 
>   tests/btrfs/017     | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>   tests/btrfs/017.out |  5 ++++
>   tests/btrfs/group   |  1 +
>   3 files changed, 88 insertions(+)
>   create mode 100755 tests/btrfs/017
>   create mode 100644 tests/btrfs/017.out
> 
> diff --git a/tests/btrfs/017 b/tests/btrfs/017
> new file mode 100755
> index 0000000..7937607
> --- /dev/null
> +++ b/tests/btrfs/017
> @@ -0,0 +1,82 @@
> +#! /bin/bash
> +# FS QA Test No. 017
> +#
> +# Verify that removing shared extents can end up incorrect qgroup accounting.
> +#
> +# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
> +# this will throw a warning into dmesg.
> +#
> +# The issue is fixed by https://patchwork.kernel.org/patch/5499981/
> +# "Btrfs: fix a warning of qgroup account on shared extents"
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2014 Liu Bo.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1	# failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +    cd /
> +    rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +
> +_need_to_be_root
> +_supported_fs btrfs
> +_supported_os Linux
> +_require_scratch
> +_require_cloner
> +
> +rm -f $seqres.full
> +
> +_scratch_mkfs "--nodesize 4096"
> +_scratch_mount
> +
> +$XFS_IO_PROG -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo | _filter_xfs_io
> +
> +_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
> +
> +$CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
> +$CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
> +$CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2
> +
> +_run_btrfs_util_prog quota enable $SCRATCH_MNT
> +_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
> +
> +rm -fr $SCRATCH_MNT/foo*
> +rm -fr $SCRATCH_MNT/snap/foo*
> +
> +sync
> +
> +$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $AWK_PROG '/[0-9]/ {print $2" "$3}'
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/btrfs/017.out b/tests/btrfs/017.out
> new file mode 100644
> index 0000000..7658e2e
> --- /dev/null
> +++ b/tests/btrfs/017.out
> @@ -0,0 +1,5 @@
> +QA output created by 017
> +wrote 8192/8192 bytes at offset 0
> +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> +4096 4096
> +4096 4096
> diff --git a/tests/btrfs/group b/tests/btrfs/group
> index abb2fe4..e29999b 100644
> --- a/tests/btrfs/group
> +++ b/tests/btrfs/group
> @@ -19,6 +19,7 @@
>   014 auto balance
>   015 auto quick snapshot
>   016 auto quick send
> +017 auto quick qgroup
>   018 auto quick subvol
>   019 auto quick send
>   020 auto quick replace
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4] xfstests: btrfs: add test case for qgroup account on shared extents
  2014-12-19  9:21   ` Satoru Takeuchi
@ 2014-12-19  9:29     ` Liu Bo
  0 siblings, 0 replies; 17+ messages in thread
From: Liu Bo @ 2014-12-19  9:29 UTC (permalink / raw)
  To: Satoru Takeuchi; +Cc: fstests, linux-btrfs

Hi Satoru san,
On Fri, Dec 19, 2014 at 06:21:30PM +0900, Satoru Takeuchi wrote:
> Hi Liu,
> 
> On 2014/12/19 17:31, Liu Bo wrote:
> > This is a regression test of
> > 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
> > it's used to verify that removing shared extents can end up incorrect
> > qgroup accounting.
> > 
> > It can produce qgroup related warnings.
> > 
> > The fix is https://patchwork.kernel.org/patch/5499981/
> > "Btrfs: fix a warning of qgroup account on shared extents"
> > 
> > Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> > Tested-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
> 
> V4 also passed my test,

Thanks for your active testing!

Thanks,

-liubo

> 
> Thanks,
> Satoru
> 
> > Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
> > Reviewed-by: Eryu Guan <eguan@redhat.com>
> > ---
> > v4: - remove inproper run_check macro and add filter macro for xfs_io
> >      - use awk's regexp directly
> >      - add test case description
> > 
> > v3: - remove trailing whilespace.
> >      - add the fix link for more details of the problem.
> > 
> > v2: - use new seq number 017 instead 080
> >      - use 'cloner' to get shared extents
> >      - use XFS_IO_PROG instead
> > 
> >   tests/btrfs/017     | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >   tests/btrfs/017.out |  5 ++++
> >   tests/btrfs/group   |  1 +
> >   3 files changed, 88 insertions(+)
> >   create mode 100755 tests/btrfs/017
> >   create mode 100644 tests/btrfs/017.out
> > 
> > diff --git a/tests/btrfs/017 b/tests/btrfs/017
> > new file mode 100755
> > index 0000000..7937607
> > --- /dev/null
> > +++ b/tests/btrfs/017
> > @@ -0,0 +1,82 @@
> > +#! /bin/bash
> > +# FS QA Test No. 017
> > +#
> > +# Verify that removing shared extents can end up incorrect qgroup accounting.
> > +#
> > +# Regression of 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")',
> > +# this will throw a warning into dmesg.
> > +#
> > +# The issue is fixed by https://patchwork.kernel.org/patch/5499981/
> > +# "Btrfs: fix a warning of qgroup account on shared extents"
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2014 Liu Bo.  All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#-----------------------------------------------------------------------
> > +#
> > +
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1	# failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +    cd /
> > +    rm -f $tmp.*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +
> > +_need_to_be_root
> > +_supported_fs btrfs
> > +_supported_os Linux
> > +_require_scratch
> > +_require_cloner
> > +
> > +rm -f $seqres.full
> > +
> > +_scratch_mkfs "--nodesize 4096"
> > +_scratch_mount
> > +
> > +$XFS_IO_PROG -f -d -c "pwrite 0 8K" $SCRATCH_MNT/foo | _filter_xfs_io
> > +
> > +_run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap
> > +
> > +$CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/foo-reflink
> > +$CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink
> > +$CLONER_PROG -s 0 -d 0 -l 8192 $SCRATCH_MNT/foo $SCRATCH_MNT/snap/foo-reflink2
> > +
> > +_run_btrfs_util_prog quota enable $SCRATCH_MNT
> > +_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
> > +
> > +rm -fr $SCRATCH_MNT/foo*
> > +rm -fr $SCRATCH_MNT/snap/foo*
> > +
> > +sync
> > +
> > +$BTRFS_UTIL_PROG qgroup show $SCRATCH_MNT | $AWK_PROG '/[0-9]/ {print $2" "$3}'
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/btrfs/017.out b/tests/btrfs/017.out
> > new file mode 100644
> > index 0000000..7658e2e
> > --- /dev/null
> > +++ b/tests/btrfs/017.out
> > @@ -0,0 +1,5 @@
> > +QA output created by 017
> > +wrote 8192/8192 bytes at offset 0
> > +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> > +4096 4096
> > +4096 4096
> > diff --git a/tests/btrfs/group b/tests/btrfs/group
> > index abb2fe4..e29999b 100644
> > --- a/tests/btrfs/group
> > +++ b/tests/btrfs/group
> > @@ -19,6 +19,7 @@
> >   014 auto balance
> >   015 auto quick snapshot
> >   016 auto quick send
> > +017 auto quick qgroup
> >   018 auto quick subvol
> >   019 auto quick send
> >   020 auto quick replace
> > 
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-12-19  9:29 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-16  9:43 [PATCH] xfstests: btrfs/080 add test case for qgroup account on shared extents Liu Bo
2014-12-16 12:10 ` Eryu Guan
2014-12-17  3:12   ` Satoru Takeuchi
2014-12-17  3:38     ` Liu Bo
2014-12-17  3:36   ` Liu Bo
2014-12-17  3:45 ` [PATCH] xfstests: btrfs: " Liu Bo
2014-12-17  3:51 ` [PATCH v2] " Liu Bo
2014-12-17  5:25   ` Eryu Guan
2014-12-17  8:13     ` Liu Bo
2014-12-17  8:24     ` Liu Bo
2014-12-17  8:30 ` [PATCH v3] " Liu Bo
2014-12-17 10:00   ` Satoru Takeuchi
2014-12-18  0:05   ` Dave Chinner
2014-12-19  8:29     ` Liu Bo
2014-12-19  8:31 ` [PATCH v4] " Liu Bo
2014-12-19  9:21   ` Satoru Takeuchi
2014-12-19  9:29     ` Liu Bo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox