linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] Fix _scratch_mkfs_sized() for btrfs
@ 2018-09-24 10:16 Anand Jain
  2018-09-24 10:16 ` [PATCH 1/9] fstests: btrfs: _scratch_mkfs_sized fix min size without mixed option Anand Jain
                   ` (8 more replies)
  0 siblings, 9 replies; 16+ messages in thread
From: Anand Jain @ 2018-09-24 10:16 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

Currently _scratch_mkfs_sized() checks if requested size for the fs
is below 1G for btrfs and forces the --mixed mkfs option. The 1G size
cut off is too larger where the actual size is 114294784 bytes. The
patch 1/9 fixes the _scratch_mkfs_sized() to check for 114294784
bytes instead. By this now we test the default config (non mixed).
And the mixed option may still be tested using the MKFS_OPTIONS.
This change only affect btrfs FS and test cases using the
_scratch_mkfs_sized() in generic and btrfs.


Also, to make sure btrfs is created in non-mixed mode, so in each individual test cases we need to make sure that _scratch_mkfs_sized()
been requested to create a FS of at least 200mb in size (114294784
bytes rounded off to the nearest 100). And there are few test
cases which does not do that, Patches [2,3,4,8,9]/9 fixes them.
These changes affects all FS as such.

And there are some test cases where we use local
variable as an option for the _scratch_mkfs_sized() is being used
and this local variable is not used anywhere else with in the test
case. So patches [5,6,7]/9 drops the local variable and open codes
it. This is a straight forward change as the fs size is kept same
as in the original.

Further, there are test cases generic/250,252,256 which uses
_scratch_mkfs_sized with < 200mb but its fix isn't straight forward
and they are not yet ready for the review.

The affected testcases (which calls _scratch_mkfs_sized) [1] have
been tested with xfs/ext4 and btrfs. And there are no regressions.

[1]
generic/015 generic/027 generic/077 generic/081 generic/083 generic/085 generic/096 generic/102 generic/171 generic/172 generic/173 generic/174 generic/204 generic/224 generic/226 generic/250 generic/252 generic/256 generic/269 generic/270 generic/273 generic/274 generic/275 generic/300 generic/312 generic/320 generic/333 generic/334 generic/361 generic/371 generic/387 generic/399 generic/416 generic/427 generic/449 generic/459 generic/466 generic/488 generic/505 btrfs/004 btrfs/007 btrfs/132 btrfs/170

Anand Jain (9):
  fstests: btrfs: _scratch_mkfs_sized fix min size without mixed option
  generic/015 fix to test the default non-mixed mode
  geneirc/077 fix min size for btrfs
  generic/083 create at least 200mb fs
  generic/102 open code dev_size _scratch_mkfs_sized()
  generic/204 open code SIZE for _scratch_mkfs_sized()
  generic/312 open code fs_size _scratch_mkfs_sized()
  generic/449 fix fs size for _scratch_mkfs_sized for btrfs
  generic/387 fix _scratch_mkfs_sized option for btrfs

 common/rc         | 4 +++-
 tests/generic/015 | 9 ++++-----
 tests/generic/077 | 3 +--
 tests/generic/083 | 2 +-
 tests/generic/102 | 3 +--
 tests/generic/204 | 3 +--
 tests/generic/312 | 7 +++----
 tests/generic/387 | 3 ++-
 tests/generic/449 | 4 ++--
 9 files changed, 18 insertions(+), 20 deletions(-)

-- 
1.8.3.1

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

* [PATCH 1/9] fstests: btrfs: _scratch_mkfs_sized fix min size without mixed option
  2018-09-24 10:16 [PATCH 0/9] Fix _scratch_mkfs_sized() for btrfs Anand Jain
@ 2018-09-24 10:16 ` Anand Jain
  2018-09-24 10:58   ` Qu Wenruo
  2018-09-24 10:16 ` [PATCH 2/9] generic/015 fix to test the default non-mixed mode Anand Jain
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Anand Jain @ 2018-09-24 10:16 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

As of now _scratch_mkfs_sized check if the requested size is below 1G
and forces the --mixed option for the mkfs.btrfs. Well the correct size
at which we need to force the mixed option is 114294784bytes. Fix that.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 common/rc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/rc b/common/rc
index d5bb1feee2c3..bcdbf03e1bf0 100644
--- a/common/rc
+++ b/common/rc
@@ -969,7 +969,9 @@ _scratch_mkfs_sized()
 	;;
     btrfs)
 	local mixed_opt=
-	(( fssize <= 1024 * 1024 * 1024 )) && mixed_opt='--mixed'
+	# minimum size that's needed without the mixed option.
+	# Non mixed mode is also the default option.
+	(( fssize < 114294784 )) && mixed_opt='--mixed'
 	$MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
 	;;
     jfs)
-- 
1.8.3.1

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

* [PATCH 2/9] generic/015 fix to test the default non-mixed mode
  2018-09-24 10:16 [PATCH 0/9] Fix _scratch_mkfs_sized() for btrfs Anand Jain
  2018-09-24 10:16 ` [PATCH 1/9] fstests: btrfs: _scratch_mkfs_sized fix min size without mixed option Anand Jain
@ 2018-09-24 10:16 ` Anand Jain
  2018-09-24 11:01   ` Qu Wenruo
  2018-09-24 10:16 ` [PATCH 3/9] geneirc/077 fix min size for btrfs Anand Jain
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Anand Jain @ 2018-09-24 10:16 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

commit 97575acd7495 (generic/015: Change the test filesystem size to
101mb), created 101mb FS instead of 100mb FS to make sure we create
a FS which is non mixed mode, which is our default mode.

btrfs-progs commit 18e2663db3e1 (btrfs-progs: Add minimum device size
check) added a more accurate minimum required space to create the btrfs
FS in non mixed mode. Which is at 14294784 bytes.

So this patch changes the FS size to be created by _scratch_sized_mkfs
to 200mb so that we create the FS in non mixed mode.

To test mixed blockgroup its better we set it using the MKFS_OPTIONS
explicitly.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/generic/015 | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/tests/generic/015 b/tests/generic/015
index 0f4d29800f4f..14941ab6d552 100755
--- a/tests/generic/015
+++ b/tests/generic/015
@@ -37,11 +37,10 @@ _supported_os Linux
 _require_scratch
 _require_no_large_scratch_dev
 
-# With filesystems less than 100mb btrfs is created in mixed mode
-# which can lead to slight accounting errors of 1mb. Having the
-# fs be at least 101 mb ensures those errors are within the error
-# tolerance of 1%
-_scratch_mkfs_sized `expr 101 \* 1024 \* 1024` >/dev/null 2>&1 \
+# With filesystems less than ~200mb _scratch_mkfs_sized will create
+# data and metadata mixed mode btrfs, so use 200mb so that we test
+# the default btrfs.
+_scratch_mkfs_sized $((200 * 1024 * 1024)) >> $seqres.full 2>&1 \
     || _fail "mkfs failed"
 _scratch_mount
 out=$SCRATCH_MNT/fillup.$$
-- 
1.8.3.1

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

* [PATCH 3/9] geneirc/077 fix min size for btrfs
  2018-09-24 10:16 [PATCH 0/9] Fix _scratch_mkfs_sized() for btrfs Anand Jain
  2018-09-24 10:16 ` [PATCH 1/9] fstests: btrfs: _scratch_mkfs_sized fix min size without mixed option Anand Jain
  2018-09-24 10:16 ` [PATCH 2/9] generic/015 fix to test the default non-mixed mode Anand Jain
@ 2018-09-24 10:16 ` Anand Jain
  2018-09-24 10:16 ` [PATCH 4/9] generic/083 create at least 200mb fs Anand Jain
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Anand Jain @ 2018-09-24 10:16 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

If btrfs need to be tested at its default blockgroup which is non-mixed,
then it needs at least ~200mb (upward round off to nearest 100'),
instead of 50mb use 200mb to test this test case.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/generic/077 | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/generic/077 b/tests/generic/077
index ef6af18c83e3..60c3493451c7 100755
--- a/tests/generic/077
+++ b/tests/generic/077
@@ -49,8 +49,7 @@ rm -f $seqres.full
 _scratch_unmount >/dev/null 2>&1
 echo "*** MKFS ***"                         >>$seqres.full
 echo ""                                     >>$seqres.full
-SIZE=`expr 50 \* 1024 \* 1024`
-_scratch_mkfs_sized $SIZE                   >>$seqres.full 2>&1 \
+_scratch_mkfs_sized $((200 * 1024 *1024))   >>$seqres.full 2>&1 \
 	|| _fail "mkfs failed"
 _scratch_mount
 mkdir $SCRATCH_MNT/subdir
-- 
1.8.3.1

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

* [PATCH 4/9] generic/083 create at least 200mb fs
  2018-09-24 10:16 [PATCH 0/9] Fix _scratch_mkfs_sized() for btrfs Anand Jain
                   ` (2 preceding siblings ...)
  2018-09-24 10:16 ` [PATCH 3/9] geneirc/077 fix min size for btrfs Anand Jain
@ 2018-09-24 10:16 ` Anand Jain
  2018-09-24 10:16 ` [PATCH 5/9] generic/102 open code dev_size _scratch_mkfs_sized() Anand Jain
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Anand Jain @ 2018-09-24 10:16 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

btrfs needs at least ~200mb to create a FS with the defaults options,
so instead of 100mb create 200mb sized fs.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/generic/083 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/generic/083 b/tests/generic/083
index 63d96ba2ab88..e5f0a88ef221 100755
--- a/tests/generic/083
+++ b/tests/generic/083
@@ -71,7 +71,7 @@ workout()
 
 echo "*** test out-of-space handling for random write operations"
 
-filesize=`expr 100 \* 1024 \* 1024`
+filesize=`expr 200 \* 1024 \* 1024`
 agcount=6
 numprocs=15
 numops=1500
-- 
1.8.3.1

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

* [PATCH 5/9] generic/102 open code dev_size _scratch_mkfs_sized()
  2018-09-24 10:16 [PATCH 0/9] Fix _scratch_mkfs_sized() for btrfs Anand Jain
                   ` (3 preceding siblings ...)
  2018-09-24 10:16 ` [PATCH 4/9] generic/083 create at least 200mb fs Anand Jain
@ 2018-09-24 10:16 ` Anand Jain
  2018-09-24 10:16 ` [PATCH 6/9] generic/204 open code SIZE for _scratch_mkfs_sized() Anand Jain
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Anand Jain @ 2018-09-24 10:16 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

Open code helps to grep and find out parameter sent to the
_scratch_mkfs_sized here.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/generic/102 | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/generic/102 b/tests/generic/102
index faf940ac5070..aad496a5bc69 100755
--- a/tests/generic/102
+++ b/tests/generic/102
@@ -31,8 +31,7 @@ _require_scratch
 
 rm -f $seqres.full
 
-dev_size=$((512 * 1024 * 1024))     # 512MB filesystem
-_scratch_mkfs_sized $dev_size >>$seqres.full 2>&1
+_scratch_mkfs_sized $((512 * 1024 * 1024)) >>$seqres.full 2>&1
 _scratch_mount
 
 for ((i = 0; i < 10; i++)); do
-- 
1.8.3.1

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

* [PATCH 6/9] generic/204 open code SIZE for _scratch_mkfs_sized()
  2018-09-24 10:16 [PATCH 0/9] Fix _scratch_mkfs_sized() for btrfs Anand Jain
                   ` (4 preceding siblings ...)
  2018-09-24 10:16 ` [PATCH 5/9] generic/102 open code dev_size _scratch_mkfs_sized() Anand Jain
@ 2018-09-24 10:16 ` Anand Jain
  2018-09-24 10:16 ` [PATCH 7/9] generic/312 open code fs_size _scratch_mkfs_sized() Anand Jain
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Anand Jain @ 2018-09-24 10:16 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

By open code we could grep to find out FS size being use by this test
case.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/generic/204 | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/generic/204 b/tests/generic/204
index 349f5eff351f..576c4eabd359 100755
--- a/tests/generic/204
+++ b/tests/generic/204
@@ -42,8 +42,7 @@ _scratch_mkfs 2> /dev/null | _filter_mkfs 2> $tmp.mkfs > /dev/null
 # time solves this problem.
 [ $FSTYP = "xfs" ] && MKFS_OPTIONS="$MKFS_OPTIONS -l size=16m -i maxpct=50"
 
-SIZE=`expr 115 \* 1024 \* 1024`
-_scratch_mkfs_sized $SIZE $dbsize 2> /dev/null > $tmp.mkfs.raw
+_scratch_mkfs_sized $((115 * 1024 * 1024)) $dbsize 2> /dev/null > $tmp.mkfs.raw
 cat $tmp.mkfs.raw | _filter_mkfs 2> $tmp.mkfs > /dev/null
 _scratch_mount
 
-- 
1.8.3.1

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

* [PATCH 7/9] generic/312 open code fs_size _scratch_mkfs_sized()
  2018-09-24 10:16 [PATCH 0/9] Fix _scratch_mkfs_sized() for btrfs Anand Jain
                   ` (5 preceding siblings ...)
  2018-09-24 10:16 ` [PATCH 6/9] generic/204 open code SIZE for _scratch_mkfs_sized() Anand Jain
@ 2018-09-24 10:16 ` Anand Jain
  2018-09-24 10:16 ` [PATCH 8/9] generic/449 fix fs size for _scratch_mkfs_sized for btrfs Anand Jain
  2018-09-24 10:16 ` [PATCH 9/9] generic/387 fix _scratch_mkfs_sized option " Anand Jain
  8 siblings, 0 replies; 16+ messages in thread
From: Anand Jain @ 2018-09-24 10:16 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

fs_size isn't used anywhere else further more now grep tells what size
is being used.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/generic/312 | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tests/generic/312 b/tests/generic/312
index 756f5c3e4c5a..465009c8d184 100755
--- a/tests/generic/312
+++ b/tests/generic/312
@@ -34,11 +34,10 @@ _supported_os Linux
 _require_xfs_io_command "falloc"
 _require_scratch
 
-# 5G in byte
-fssize=$((2**30 * 5))
-
 rm -f $seqres.full
-_scratch_mkfs_sized $fssize >>$seqres.full 2>&1
+
+# 5G FS
+_scratch_mkfs_sized $((2**30 * 5)) >>$seqres.full 2>&1
 _scratch_mount >>$seqres.full 2>&1
 
 echo "Silence is golden"
-- 
1.8.3.1

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

* [PATCH 8/9] generic/449 fix fs size for _scratch_mkfs_sized for btrfs
  2018-09-24 10:16 [PATCH 0/9] Fix _scratch_mkfs_sized() for btrfs Anand Jain
                   ` (6 preceding siblings ...)
  2018-09-24 10:16 ` [PATCH 7/9] generic/312 open code fs_size _scratch_mkfs_sized() Anand Jain
@ 2018-09-24 10:16 ` Anand Jain
  2018-09-24 10:16 ` [PATCH 9/9] generic/387 fix _scratch_mkfs_sized option " Anand Jain
  8 siblings, 0 replies; 16+ messages in thread
From: Anand Jain @ 2018-09-24 10:16 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

btrfs needs ~200m to create btrfs with default options like non mixed
block groups.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/generic/449 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/generic/449 b/tests/generic/449
index 88f918654b54..47c219222dde 100755
--- a/tests/generic/449
+++ b/tests/generic/449
@@ -41,7 +41,7 @@ _require_test
 _require_acls
 _require_attrs
 
-_scratch_mkfs_sized $((50 * 1024 * 1024)) >> $seqres.full 2>&1
+_scratch_mkfs_sized $((200 * 1024 * 1024)) >> $seqres.full 2>&1
 _scratch_mount || _fail "mount failed"
 
 TFILE=$SCRATCH_MNT/testfile.$seq
@@ -52,7 +52,7 @@ chmod u+rwx $TFILE
 chmod go-rwx $TFILE
 
 # Try to run out of space so setfacl will fail
-$XFS_IO_PROG -c "pwrite 0 50m" $TFILE >>$seqres.full 2>&1
+$XFS_IO_PROG -c "pwrite 0 200m" $TFILE >>$seqres.full 2>&1
 i=1
 
 # Setting acls on an xfs filesystem will succeed even after running out of
-- 
1.8.3.1

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

* [PATCH 9/9] generic/387 fix _scratch_mkfs_sized option for btrfs
  2018-09-24 10:16 [PATCH 0/9] Fix _scratch_mkfs_sized() for btrfs Anand Jain
                   ` (7 preceding siblings ...)
  2018-09-24 10:16 ` [PATCH 8/9] generic/449 fix fs size for _scratch_mkfs_sized for btrfs Anand Jain
@ 2018-09-24 10:16 ` Anand Jain
  8 siblings, 0 replies; 16+ messages in thread
From: Anand Jain @ 2018-09-24 10:16 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

btrfs needs 200mb to create a fs with default block group which is non
mixed, so pass 200mb to _scratch_mkfs_sized().

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/generic/387 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/generic/387 b/tests/generic/387
index 68a48012faa5..9d9d65d222c8 100755
--- a/tests/generic/387
+++ b/tests/generic/387
@@ -35,7 +35,8 @@ _supported_fs generic
 _supported_os Linux
 _require_scratch_reflink
 
-_scratch_mkfs_sized $((32 * 1024 * 1024)) >> $seqres.full 2>&1
+#btrfs needs ~200mb to create default blockgroup fs
+_scratch_mkfs_sized $((200 * 1024 * 1024)) >> $seqres.full 2>&1
 _scratch_mount
 
 testfile=$SCRATCH_MNT/testfile
-- 
1.8.3.1

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

* Re: [PATCH 1/9] fstests: btrfs: _scratch_mkfs_sized fix min size without mixed option
  2018-09-24 10:16 ` [PATCH 1/9] fstests: btrfs: _scratch_mkfs_sized fix min size without mixed option Anand Jain
@ 2018-09-24 10:58   ` Qu Wenruo
  2018-09-24 11:53     ` Anand Jain
  0 siblings, 1 reply; 16+ messages in thread
From: Qu Wenruo @ 2018-09-24 10:58 UTC (permalink / raw)
  To: Anand Jain, fstests; +Cc: linux-btrfs


[-- Attachment #1.1: Type: text/plain, Size: 1318 bytes --]



On 2018/9/24 下午6:16, Anand Jain wrote:
> As of now _scratch_mkfs_sized check if the requested size is below 1G
> and forces the --mixed option for the mkfs.btrfs. Well the correct size
> at which we need to force the mixed option is 114294784bytes. Fix that.

How this size is get from?
If it's from btrfs_min_dev_size(), I strongly recommend to add reference
here, and don't use the ugly intermediate number.


BTW, this number is related to mkfs profile.
If you really want to use some maximum number, please follow the max
possible value in btrfs_min_dev_size(), which should be 229M other than
106M.

Thanks,
Qu

> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  common/rc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/common/rc b/common/rc
> index d5bb1feee2c3..bcdbf03e1bf0 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -969,7 +969,9 @@ _scratch_mkfs_sized()
>  	;;
>      btrfs)
>  	local mixed_opt=
> -	(( fssize <= 1024 * 1024 * 1024 )) && mixed_opt='--mixed'
> +	# minimum size that's needed without the mixed option.
> +	# Non mixed mode is also the default option.
> +	(( fssize < 114294784 )) && mixed_opt='--mixed'
>  	$MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
>  	;;
>      jfs)
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 2/9] generic/015 fix to test the default non-mixed mode
  2018-09-24 10:16 ` [PATCH 2/9] generic/015 fix to test the default non-mixed mode Anand Jain
@ 2018-09-24 11:01   ` Qu Wenruo
  2018-09-24 11:55     ` Anand Jain
  0 siblings, 1 reply; 16+ messages in thread
From: Qu Wenruo @ 2018-09-24 11:01 UTC (permalink / raw)
  To: Anand Jain, fstests; +Cc: linux-btrfs


[-- Attachment #1.1: Type: text/plain, Size: 2214 bytes --]



On 2018/9/24 下午6:16, Anand Jain wrote:
> commit 97575acd7495 (generic/015: Change the test filesystem size to
> 101mb), created 101mb FS instead of 100mb FS to make sure we create
> a FS which is non mixed mode, which is our default mode.
> 
> btrfs-progs commit 18e2663db3e1 (btrfs-progs: Add minimum device size
> check) added a more accurate minimum required space to create the btrfs
> FS in non mixed mode. Which is at 14294784 bytes.
> 
> So this patch changes the FS size to be created by _scratch_sized_mkfs
> to 200mb so that we create the FS in non mixed mode.
> 
> To test mixed blockgroup its better we set it using the MKFS_OPTIONS
> explicitly.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  tests/generic/015 | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/generic/015 b/tests/generic/015
> index 0f4d29800f4f..14941ab6d552 100755
> --- a/tests/generic/015
> +++ b/tests/generic/015
> @@ -37,11 +37,10 @@ _supported_os Linux
>  _require_scratch
>  _require_no_large_scratch_dev
>  
> -# With filesystems less than 100mb btrfs is created in mixed mode
> -# which can lead to slight accounting errors of 1mb. Having the
> -# fs be at least 101 mb ensures those errors are within the error
> -# tolerance of 1%
> -_scratch_mkfs_sized `expr 101 \* 1024 \* 1024` >/dev/null 2>&1 \
> +# With filesystems less than ~200mb _scratch_mkfs_sized will create
> +# data and metadata mixed mode btrfs, so use 200mb so that we test
> +# the default btrfs.
> +_scratch_mkfs_sized $((200 * 1024 * 1024)) >> $seqres.full 2>&1 \
>      || _fail "mkfs failed"

Just as mentioned in the first patch, the minimal size for non-mixed
btrfs depends on mkfs profile.

Metadata DUP and data DUP would fail using 200M mkfs size:

 $ mkfs.btrfs  -m DUP -d DUP -b 200M /dev/data/btrfs -f
 btrfs-progs v4.17.1
 See http://btrfs.wiki.kernel.org for more information.

 ERROR: size 209715200 is too small to make a usable filesystem
 ERROR: minimum size for btrfs filesystem is 240123904

This problem applies to all patches, unfortunately.

Thanks,
Qu

>  _scratch_mount
>  out=$SCRATCH_MNT/fillup.$$
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 1/9] fstests: btrfs: _scratch_mkfs_sized fix min size without mixed option
  2018-09-24 10:58   ` Qu Wenruo
@ 2018-09-24 11:53     ` Anand Jain
  2018-09-24 12:02       ` Qu Wenruo
  0 siblings, 1 reply; 16+ messages in thread
From: Anand Jain @ 2018-09-24 11:53 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: fstests, linux-btrfs



On 09/24/2018 06:58 PM, Qu Wenruo wrote:
> 
> 
> On 2018/9/24 下午6:16, Anand Jain wrote:
>> As of now _scratch_mkfs_sized check if the requested size is below 1G
>> and forces the --mixed option for the mkfs.btrfs. Well the correct size
>> at which we need to force the mixed option is 114294784bytes. Fix that.
> 
> How this size is get from?
> If it's from btrfs_min_dev_size(), I strongly recommend to add reference
> here, and don't use the ugly intermediate number.
> 
> 
> BTW, this number is related to mkfs profile.
> If you really want to use some maximum number, please follow the max
> possible value in btrfs_min_dev_size(), which should be 229M other than
> 106M.

  Thanks for the comments. I completely missed out the point of other
  group profile requiring more than ~115 bytes. Will fix.
  Yep the ref for the size is btrfs_min_dev_size().

-Anand


> Thanks,
> Qu
> 
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>>   common/rc | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/common/rc b/common/rc
>> index d5bb1feee2c3..bcdbf03e1bf0 100644
>> --- a/common/rc
>> +++ b/common/rc
>> @@ -969,7 +969,9 @@ _scratch_mkfs_sized()
>>   	;;
>>       btrfs)
>>   	local mixed_opt=
>> -	(( fssize <= 1024 * 1024 * 1024 )) && mixed_opt='--mixed'
>> +	# minimum size that's needed without the mixed option.
>> +	# Non mixed mode is also the default option.
>> +	(( fssize < 114294784 )) && mixed_opt='--mixed'
>>   	$MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
>>   	;;
>>       jfs)
>>
> 

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

* Re: [PATCH 2/9] generic/015 fix to test the default non-mixed mode
  2018-09-24 11:01   ` Qu Wenruo
@ 2018-09-24 11:55     ` Anand Jain
  0 siblings, 0 replies; 16+ messages in thread
From: Anand Jain @ 2018-09-24 11:55 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: fstests, linux-btrfs



On 09/24/2018 07:01 PM, Qu Wenruo wrote:
> 
> 
> On 2018/9/24 下午6:16, Anand Jain wrote:
>> commit 97575acd7495 (generic/015: Change the test filesystem size to
>> 101mb), created 101mb FS instead of 100mb FS to make sure we create
>> a FS which is non mixed mode, which is our default mode.
>>
>> btrfs-progs commit 18e2663db3e1 (btrfs-progs: Add minimum device size
>> check) added a more accurate minimum required space to create the btrfs
>> FS in non mixed mode. Which is at 14294784 bytes.
>>
>> So this patch changes the FS size to be created by _scratch_sized_mkfs
>> to 200mb so that we create the FS in non mixed mode.
>>
>> To test mixed blockgroup its better we set it using the MKFS_OPTIONS
>> explicitly.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>>   tests/generic/015 | 9 ++++-----
>>   1 file changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/tests/generic/015 b/tests/generic/015
>> index 0f4d29800f4f..14941ab6d552 100755
>> --- a/tests/generic/015
>> +++ b/tests/generic/015
>> @@ -37,11 +37,10 @@ _supported_os Linux
>>   _require_scratch
>>   _require_no_large_scratch_dev
>>   
>> -# With filesystems less than 100mb btrfs is created in mixed mode
>> -# which can lead to slight accounting errors of 1mb. Having the
>> -# fs be at least 101 mb ensures those errors are within the error
>> -# tolerance of 1%
>> -_scratch_mkfs_sized `expr 101 \* 1024 \* 1024` >/dev/null 2>&1 \
>> +# With filesystems less than ~200mb _scratch_mkfs_sized will create
>> +# data and metadata mixed mode btrfs, so use 200mb so that we test
>> +# the default btrfs.
>> +_scratch_mkfs_sized $((200 * 1024 * 1024)) >> $seqres.full 2>&1 \
>>       || _fail "mkfs failed"
> 
> Just as mentioned in the first patch, the minimal size for non-mixed
> btrfs depends on mkfs profile.
> 
> Metadata DUP and data DUP would fail using 200M mkfs size:
> 
>   $ mkfs.btrfs  -m DUP -d DUP -b 200M /dev/data/btrfs -f
>   btrfs-progs v4.17.1
>   See http://btrfs.wiki.kernel.org for more information.
> 
>   ERROR: size 209715200 is too small to make a usable filesystem
>   ERROR: minimum size for btrfs filesystem is 240123904
> 
> This problem applies to all patches, unfortunately.

  Yes. Handling the other (non default) group profiles is missing.
  Will fix.

Thanks, Anand


> Thanks,
> Qu
> 
>>   _scratch_mount
>>   out=$SCRATCH_MNT/fillup.$$
>>
> 

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

* Re: [PATCH 1/9] fstests: btrfs: _scratch_mkfs_sized fix min size without mixed option
  2018-09-24 11:53     ` Anand Jain
@ 2018-09-24 12:02       ` Qu Wenruo
  2018-09-24 13:40         ` Anand Jain
  0 siblings, 1 reply; 16+ messages in thread
From: Qu Wenruo @ 2018-09-24 12:02 UTC (permalink / raw)
  To: Anand Jain; +Cc: fstests, linux-btrfs


[-- Attachment #1.1: Type: text/plain, Size: 2087 bytes --]



On 2018/9/24 下午7:53, Anand Jain wrote:
> 
> 
> On 09/24/2018 06:58 PM, Qu Wenruo wrote:
>>
>>
>> On 2018/9/24 下午6:16, Anand Jain wrote:
>>> As of now _scratch_mkfs_sized check if the requested size is below 1G
>>> and forces the --mixed option for the mkfs.btrfs. Well the correct size
>>> at which we need to force the mixed option is 114294784bytes. Fix that.
>>
>> How this size is get from?
>> If it's from btrfs_min_dev_size(), I strongly recommend to add reference
>> here, and don't use the ugly intermediate number.
>>
>>
>> BTW, this number is related to mkfs profile.
>> If you really want to use some maximum number, please follow the max
>> possible value in btrfs_min_dev_size(), which should be 229M other than
>> 106M.
> 
>  Thanks for the comments. I completely missed out the point of other
>  group profile requiring more than ~115 bytes. Will fix.

I'd go a rounded number, like 256M.

Non of the number from btrfs_min_dev_size() is really easy to remember
nor makes sense out of btrfs realm.

And this also leaves a little more headroom for later modification
(although I hope such modification never happen)

Thanks,
Qu

>  Yep the ref for the size is btrfs_min_dev_size().
> 
> -Anand
> 
> 
>> Thanks,
>> Qu
>>
>>>
>>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>>> ---
>>>   common/rc | 4 +++-
>>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/common/rc b/common/rc
>>> index d5bb1feee2c3..bcdbf03e1bf0 100644
>>> --- a/common/rc
>>> +++ b/common/rc
>>> @@ -969,7 +969,9 @@ _scratch_mkfs_sized()
>>>       ;;
>>>       btrfs)
>>>       local mixed_opt=
>>> -    (( fssize <= 1024 * 1024 * 1024 )) && mixed_opt='--mixed'
>>> +    # minimum size that's needed without the mixed option.
>>> +    # Non mixed mode is also the default option.
>>> +    (( fssize < 114294784 )) && mixed_opt='--mixed'
>>>       $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
>>>       ;;
>>>       jfs)
>>>
>>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 1/9] fstests: btrfs: _scratch_mkfs_sized fix min size without mixed option
  2018-09-24 12:02       ` Qu Wenruo
@ 2018-09-24 13:40         ` Anand Jain
  0 siblings, 0 replies; 16+ messages in thread
From: Anand Jain @ 2018-09-24 13:40 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: fstests, linux-btrfs



On 09/24/2018 08:02 PM, Qu Wenruo wrote:
> 
> 
> On 2018/9/24 下午7:53, Anand Jain wrote:
>>
>>
>> On 09/24/2018 06:58 PM, Qu Wenruo wrote:
>>>
>>>
>>> On 2018/9/24 下午6:16, Anand Jain wrote:
>>>> As of now _scratch_mkfs_sized check if the requested size is below 1G
>>>> and forces the --mixed option for the mkfs.btrfs. Well the correct size
>>>> at which we need to force the mixed option is 114294784bytes. Fix that.
>>>
>>> How this size is get from?
>>> If it's from btrfs_min_dev_size(), I strongly recommend to add reference
>>> here, and don't use the ugly intermediate number.
>>>
>>>
>>> BTW, this number is related to mkfs profile.
>>> If you really want to use some maximum number, please follow the max
>>> possible value in btrfs_min_dev_size(), which should be 229M other than
>>> 106M.
>>
>>   Thanks for the comments. I completely missed out the point of other
>>   group profile requiring more than ~115 bytes. Will fix.
> 
> I'd go a rounded number, like 256M.
> 
> Non of the number from btrfs_min_dev_size() is really easy to remember
> nor makes sense out of btrfs realm.
> 
> And this also leaves a little more headroom for later modification
> (although I hope such modification never happen)

  I agree. Actually I was thinking it should be like that when I was 
writing this patch, then my logical mind didn't provide any strong 
reason to back that up. As ideas match, Will fix it at 256M.

Thanks, Anand


> Thanks,
> Qu
> 
>>   Yep the ref for the size is btrfs_min_dev_size().
>>
>> -Anand
>>
>>
>>> Thanks,
>>> Qu
>>>
>>>>
>>>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>>>> ---
>>>>    common/rc | 4 +++-
>>>>    1 file changed, 3 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/common/rc b/common/rc
>>>> index d5bb1feee2c3..bcdbf03e1bf0 100644
>>>> --- a/common/rc
>>>> +++ b/common/rc
>>>> @@ -969,7 +969,9 @@ _scratch_mkfs_sized()
>>>>        ;;
>>>>        btrfs)
>>>>        local mixed_opt=
>>>> -    (( fssize <= 1024 * 1024 * 1024 )) && mixed_opt='--mixed'
>>>> +    # minimum size that's needed without the mixed option.
>>>> +    # Non mixed mode is also the default option.
>>>> +    (( fssize < 114294784 )) && mixed_opt='--mixed'
>>>>        $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
>>>>        ;;
>>>>        jfs)
>>>>
>>>
> 

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

end of thread, other threads:[~2018-09-24 19:42 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-24 10:16 [PATCH 0/9] Fix _scratch_mkfs_sized() for btrfs Anand Jain
2018-09-24 10:16 ` [PATCH 1/9] fstests: btrfs: _scratch_mkfs_sized fix min size without mixed option Anand Jain
2018-09-24 10:58   ` Qu Wenruo
2018-09-24 11:53     ` Anand Jain
2018-09-24 12:02       ` Qu Wenruo
2018-09-24 13:40         ` Anand Jain
2018-09-24 10:16 ` [PATCH 2/9] generic/015 fix to test the default non-mixed mode Anand Jain
2018-09-24 11:01   ` Qu Wenruo
2018-09-24 11:55     ` Anand Jain
2018-09-24 10:16 ` [PATCH 3/9] geneirc/077 fix min size for btrfs Anand Jain
2018-09-24 10:16 ` [PATCH 4/9] generic/083 create at least 200mb fs Anand Jain
2018-09-24 10:16 ` [PATCH 5/9] generic/102 open code dev_size _scratch_mkfs_sized() Anand Jain
2018-09-24 10:16 ` [PATCH 6/9] generic/204 open code SIZE for _scratch_mkfs_sized() Anand Jain
2018-09-24 10:16 ` [PATCH 7/9] generic/312 open code fs_size _scratch_mkfs_sized() Anand Jain
2018-09-24 10:16 ` [PATCH 8/9] generic/449 fix fs size for _scratch_mkfs_sized for btrfs Anand Jain
2018-09-24 10:16 ` [PATCH 9/9] generic/387 fix _scratch_mkfs_sized option " Anand Jain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).