diff mbox series

generic/103: leave more space for f2fs

Message ID 20210611112211.1408767-2-sunke32@huawei.com (mailing list archive)
State New, archived
Headers show
Series generic/103: leave more space for f2fs | expand

Commit Message

Sun Ke June 11, 2021, 11:22 a.m. UTC
It failed on f2fs:
     QA output created by 103
    +fallocate: No space left on device
     Silence is golden.
    ...

Try to leave ~512KB, but during the fallocate, f2fs will be filled.
Provide error prompt: "fallocate: No space left on device".

Leave more space for f2fs.

Signed-off-by: Sun Ke <sunke32@huawei.com>
---
I add some test code
	+       df
			avail=`_get_available_space $SCRATCH_MNT`
	+       echo "avail = ${avail}"
			filesizekb=$((avail / 1024 - 512))
	+       echo "filesizekb = ${filesizekb}"
			$XFS_IO_PROG -fc "falloc 0 ${filesizekb}k" $file
	+       df
	}

f2fs:
	QA output created by 103
	+Filesystem       1K-blocks       Used   Available Use% Mounted on
	...
	+/dev/sdb          12580864     553292    12027572   5% /mnt/scratch
	+avail = 12316233728
	+filesizekb = 12027060
	+fallocate: No space left on device
	+Filesystem       1K-blocks       Used   Available Use% Mounted on
	...
	+/dev/sdb          12580864   12580864           0 100% /mnt/scratch
	Silence is golden.

xfs:
	QA output created by 103
	+Filesystem       1K-blocks       Used   Available Use% Mounted on
	...
	+/dev/sdb          12572672     120828    12451844   1% /mnt/scratch
	+avail = 12750688256
	+filesizekb = 12451332
	+Filesystem       1K-blocks       Used   Available Use% Mounted on
	...
	+/dev/sdb          12572672   12572160         512 100% /mnt/scratch
	Silence is golden.

f2fs:
	QA output created by 103
	+Filesystem       1K-blocks       Used   Available Use% Mounted on
	...
	+/dev/sdb          12319880      41048    11633304   1% /mnt/scratch
	+avail = 11912503296
	+filesizekb = 11632792
	+Filesystem       1K-blocks       Used   Available Use% Mounted on
	...
	+/dev/sdb          12319880   11673844         508 100% /mnt/scratch
	Silence is golden.

after change (f2fs)
	QA output created by 103
	Filesystem       1K-blocks       Used   Available Use% Mounted on
	...
	/dev/sdb          12580864   12580396         468 100% /tmp/scratch
	Silence is golden.

 tests/generic/103 | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Eryu Guan June 13, 2021, 2:44 p.m. UTC | #1
On Fri, Jun 11, 2021 at 07:22:10PM +0800, Sun Ke wrote:
> It failed on f2fs:
>      QA output created by 103
>     +fallocate: No space left on device
>      Silence is golden.
>     ...
> 
> Try to leave ~512KB, but during the fallocate, f2fs will be filled.
> Provide error prompt: "fallocate: No space left on device".
> 
> Leave more space for f2fs.

And this also could be a bug in f2fs, that couldn't fallocate enough
space when free space is larger than request size.

I think the whole patchset needs review from f2fs folks.

Thanks,
Eryu

> 
> Signed-off-by: Sun Ke <sunke32@huawei.com>
> ---
> I add some test code
> 	+       df
> 			avail=`_get_available_space $SCRATCH_MNT`
> 	+       echo "avail = ${avail}"
> 			filesizekb=$((avail / 1024 - 512))
> 	+       echo "filesizekb = ${filesizekb}"
> 			$XFS_IO_PROG -fc "falloc 0 ${filesizekb}k" $file
> 	+       df
> 	}
> 
> f2fs:
> 	QA output created by 103
> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
> 	...
> 	+/dev/sdb          12580864     553292    12027572   5% /mnt/scratch
> 	+avail = 12316233728
> 	+filesizekb = 12027060
> 	+fallocate: No space left on device
> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
> 	...
> 	+/dev/sdb          12580864   12580864           0 100% /mnt/scratch
> 	Silence is golden.
> 
> xfs:
> 	QA output created by 103
> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
> 	...
> 	+/dev/sdb          12572672     120828    12451844   1% /mnt/scratch
> 	+avail = 12750688256
> 	+filesizekb = 12451332
> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
> 	...
> 	+/dev/sdb          12572672   12572160         512 100% /mnt/scratch
> 	Silence is golden.
> 
> f2fs:
> 	QA output created by 103
> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
> 	...
> 	+/dev/sdb          12319880      41048    11633304   1% /mnt/scratch
> 	+avail = 11912503296
> 	+filesizekb = 11632792
> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
> 	...
> 	+/dev/sdb          12319880   11673844         508 100% /mnt/scratch
> 	Silence is golden.
> 
> after change (f2fs)
> 	QA output created by 103
> 	Filesystem       1K-blocks       Used   Available Use% Mounted on
> 	...
> 	/dev/sdb          12580864   12580396         468 100% /tmp/scratch
> 	Silence is golden.
> 
>  tests/generic/103 | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/generic/103 b/tests/generic/103
> index b22b0159623e..dfce3870781c 100755
> --- a/tests/generic/103
> +++ b/tests/generic/103
> @@ -40,10 +40,18 @@ rm -f $seqres.full
>  _consume_freesp()
>  {
>  	file=$1
> +	leave=512
> +
> +	# Try to leave ~512KB, but during the fallocate, f2fs will be filled.
> +	# Provide error prompt: "fallocate: No space left on device". Leave
> +	# more space for f2fs.
> +	if [ $FSTYP == "f2fs" ]; then
> +		leave=12288
> +	fi
>  
>  	# consume nearly all available space (leave ~512kB)
>  	avail=`_get_available_space $SCRATCH_MNT`
> -	filesizekb=$((avail / 1024 - 512))
> +	filesizekb=$((avail / 1024 - $leave))
>  	$XFS_IO_PROG -fc "falloc 0 ${filesizekb}k" $file
>  }
>  
> -- 
> 2.25.4
Sun Ke June 15, 2021, 3:28 a.m. UTC | #2
to linux-f2fs-devel@lists.sourceforge.net

在 2021/6/11 19:22, Sun Ke 写道:
> It failed on f2fs:
>       QA output created by 103
>      +fallocate: No space left on device
>       Silence is golden.
>      ...
> 
> Try to leave ~512KB, but during the fallocate, f2fs will be filled.
> Provide error prompt: "fallocate: No space left on device".
> 
> Leave more space for f2fs.
> 
> Signed-off-by: Sun Ke <sunke32@huawei.com>
> ---
> I add some test code
> 	+       df
> 			avail=`_get_available_space $SCRATCH_MNT`
> 	+       echo "avail = ${avail}"
> 			filesizekb=$((avail / 1024 - 512))
> 	+       echo "filesizekb = ${filesizekb}"
> 			$XFS_IO_PROG -fc "falloc 0 ${filesizekb}k" $file
> 	+       df
> 	}
> 
> f2fs:
> 	QA output created by 103
> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
> 	...
> 	+/dev/sdb          12580864     553292    12027572   5% /mnt/scratch
> 	+avail = 12316233728
> 	+filesizekb = 12027060
> 	+fallocate: No space left on device
> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
> 	...
> 	+/dev/sdb          12580864   12580864           0 100% /mnt/scratch
> 	Silence is golden.
> 
> xfs:
> 	QA output created by 103
> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
> 	...
> 	+/dev/sdb          12572672     120828    12451844   1% /mnt/scratch
> 	+avail = 12750688256
> 	+filesizekb = 12451332
> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
> 	...
> 	+/dev/sdb          12572672   12572160         512 100% /mnt/scratch
> 	Silence is golden.
> 
> ext4:
> 	QA output created by 103
> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
> 	...
> 	+/dev/sdb          12319880      41048    11633304   1% /mnt/scratch
> 	+avail = 11912503296
> 	+filesizekb = 11632792
> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
> 	...
> 	+/dev/sdb          12319880   11673844         508 100% /mnt/scratch
> 	Silence is golden.
> 
> after change (f2fs)
> 	QA output created by 103
> 	Filesystem       1K-blocks       Used   Available Use% Mounted on
> 	...
> 	/dev/sdb          12580864   12580396         468 100% /tmp/scratch
> 	Silence is golden.
> 
>   tests/generic/103 | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/generic/103 b/tests/generic/103
> index b22b0159623e..dfce3870781c 100755
> --- a/tests/generic/103
> +++ b/tests/generic/103
> @@ -40,10 +40,18 @@ rm -f $seqres.full
>   _consume_freesp()
>   {
>   	file=$1
> +	leave=512
> +
> +	# Try to leave ~512KB, but during the fallocate, f2fs will be filled.
> +	# Provide error prompt: "fallocate: No space left on device". Leave
> +	# more space for f2fs.
> +	if [ $FSTYP == "f2fs" ]; then
> +		leave=12288
> +	fi
>   
>   	# consume nearly all available space (leave ~512kB)
>   	avail=`_get_available_space $SCRATCH_MNT`
> -	filesizekb=$((avail / 1024 - 512))
> +	filesizekb=$((avail / 1024 - $leave))
>   	$XFS_IO_PROG -fc "falloc 0 ${filesizekb}k" $file
>   }
>   
>
Sun Ke June 15, 2021, 3:36 a.m. UTC | #3
在 2021/6/13 22:44, Eryu Guan 写道:
> On Fri, Jun 11, 2021 at 07:22:10PM +0800, Sun Ke wrote:
>> It failed on f2fs:
>>       QA output created by 103
>>      +fallocate: No space left on device
>>       Silence is golden.
>>      ...
>>
>> Try to leave ~512KB, but during the fallocate, f2fs will be filled.
>> Provide error prompt: "fallocate: No space left on device".
>>
>> Leave more space for f2fs.
> 
> And this also could be a bug in f2fs, that couldn't fallocate enough
> space when free space is larger than request size.
> 
> I think the whole patchset needs review from f2fs folks.
> 
> Thanks,
> Eryu
I have cc linux-f2fs-devel@lists.sourceforge.net.

Thanks,
Sun Ke
> 
>>
>> Signed-off-by: Sun Ke <sunke32@huawei.com>
>> ---
>> I add some test code
>> 	+       df
>> 			avail=`_get_available_space $SCRATCH_MNT`
>> 	+       echo "avail = ${avail}"
>> 			filesizekb=$((avail / 1024 - 512))
>> 	+       echo "filesizekb = ${filesizekb}"
>> 			$XFS_IO_PROG -fc "falloc 0 ${filesizekb}k" $file
>> 	+       df
>> 	}
>>
>> f2fs:
>> 	QA output created by 103
>> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
>> 	...
>> 	+/dev/sdb          12580864     553292    12027572   5% /mnt/scratch
>> 	+avail = 12316233728
>> 	+filesizekb = 12027060
>> 	+fallocate: No space left on device
>> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
>> 	...
>> 	+/dev/sdb          12580864   12580864           0 100% /mnt/scratch
>> 	Silence is golden.
>>
>> xfs:
>> 	QA output created by 103
>> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
>> 	...
>> 	+/dev/sdb          12572672     120828    12451844   1% /mnt/scratch
>> 	+avail = 12750688256
>> 	+filesizekb = 12451332
>> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
>> 	...
>> 	+/dev/sdb          12572672   12572160         512 100% /mnt/scratch
>> 	Silence is golden.
>>
>> f2fs:
>> 	QA output created by 103
>> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
>> 	...
>> 	+/dev/sdb          12319880      41048    11633304   1% /mnt/scratch
>> 	+avail = 11912503296
>> 	+filesizekb = 11632792
>> 	+Filesystem       1K-blocks       Used   Available Use% Mounted on
>> 	...
>> 	+/dev/sdb          12319880   11673844         508 100% /mnt/scratch
>> 	Silence is golden.
>>
>> after change (f2fs)
>> 	QA output created by 103
>> 	Filesystem       1K-blocks       Used   Available Use% Mounted on
>> 	...
>> 	/dev/sdb          12580864   12580396         468 100% /tmp/scratch
>> 	Silence is golden.
>>
>>   tests/generic/103 | 10 +++++++++-
>>   1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/tests/generic/103 b/tests/generic/103
>> index b22b0159623e..dfce3870781c 100755
>> --- a/tests/generic/103
>> +++ b/tests/generic/103
>> @@ -40,10 +40,18 @@ rm -f $seqres.full
>>   _consume_freesp()
>>   {
>>   	file=$1
>> +	leave=512
>> +
>> +	# Try to leave ~512KB, but during the fallocate, f2fs will be filled.
>> +	# Provide error prompt: "fallocate: No space left on device". Leave
>> +	# more space for f2fs.
>> +	if [ $FSTYP == "f2fs" ]; then
>> +		leave=12288
>> +	fi
>>   
>>   	# consume nearly all available space (leave ~512kB)
>>   	avail=`_get_available_space $SCRATCH_MNT`
>> -	filesizekb=$((avail / 1024 - 512))
>> +	filesizekb=$((avail / 1024 - $leave))
>>   	$XFS_IO_PROG -fc "falloc 0 ${filesizekb}k" $file
>>   }
>>   
>> -- 
>> 2.25.4
> .
>
Chao Yu June 16, 2021, 1:15 p.m. UTC | #4
On 2021/6/15 11:28, Sun Ke wrote:
> to linux-f2fs-devel@lists.sourceforge.net
> 
> 在 2021/6/11 19:22, Sun Ke 写道:
>> It failed on f2fs:
>>       QA output created by 103
>>      +fallocate: No space left on device
>>       Silence is golden.
>>      ...
>>
>> Try to leave ~512KB, but during the fallocate, f2fs will be filled.
>> Provide error prompt: "fallocate: No space left on device".
>>
>> Leave more space for f2fs.
>>
>> Signed-off-by: Sun Ke <sunke32@huawei.com>
>> ---
>> I add some test code
>>     +       df
>>             avail=`_get_available_space $SCRATCH_MNT`
>>     +       echo "avail = ${avail}"
>>             filesizekb=$((avail / 1024 - 512))
>>     +       echo "filesizekb = ${filesizekb}"
>>             $XFS_IO_PROG -fc "falloc 0 ${filesizekb}k" $file
>>     +       df
>>     }
>>
>> f2fs:
>>     QA output created by 103
>>     +Filesystem       1K-blocks       Used   Available Use% Mounted on
>>     ...
>>     +/dev/sdb          12580864     553292    12027572   5% /mnt/scratch
>>     +avail = 12316233728
>>     +filesizekb = 12027060
>>     +fallocate: No space left on device
>>     +Filesystem       1K-blocks       Used   Available Use% Mounted on
>>     ...
>>     +/dev/sdb          12580864   12580864           0 100% /mnt/scratch
>>     Silence is golden.
>>
>> xfs:
>>     QA output created by 103
>>     +Filesystem       1K-blocks       Used   Available Use% Mounted on
>>     ...
>>     +/dev/sdb          12572672     120828    12451844   1% /mnt/scratch
>>     +avail = 12750688256
>>     +filesizekb = 12451332
>>     +Filesystem       1K-blocks       Used   Available Use% Mounted on
>>     ...
>>     +/dev/sdb          12572672   12572160         512 100% /mnt/scratch
>>     Silence is golden.
>>
>> ext4:
>>     QA output created by 103
>>     +Filesystem       1K-blocks       Used   Available Use% Mounted on
>>     ...
>>     +/dev/sdb          12319880      41048    11633304   1% /mnt/scratch
>>     +avail = 11912503296
>>     +filesizekb = 11632792
>>     +Filesystem       1K-blocks       Used   Available Use% Mounted on
>>     ...
>>     +/dev/sdb          12319880   11673844         508 100% /mnt/scratch
>>     Silence is golden.
>>
>> after change (f2fs)
>>     QA output created by 103
>>     Filesystem       1K-blocks       Used   Available Use% Mounted on
>>     ...
>>     /dev/sdb          12580864   12580396         468 100% /tmp/scratch
>>     Silence is golden.
>>
>>   tests/generic/103 | 10 +++++++++-
>>   1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/tests/generic/103 b/tests/generic/103
>> index b22b0159623e..dfce3870781c 100755
>> --- a/tests/generic/103
>> +++ b/tests/generic/103
>> @@ -40,10 +40,18 @@ rm -f $seqres.full
>>   _consume_freesp()
>>   {
>>       file=$1
>> +    leave=512
>> +
>> +    # Try to leave ~512KB, but during the fallocate, f2fs will be filled.
>> +    # Provide error prompt: "fallocate: No space left on device". Leave
>> +    # more space for f2fs.
>> +    if [ $FSTYP == "f2fs" ]; then
>> +        leave=12288
>> +    fi
>>       # consume nearly all available space (leave ~512kB)
>>       avail=`_get_available_space $SCRATCH_MNT`

         if [ $FSTYP == "f2fs" ]; then
                 left=$((left + avail / 1024000))
         fi

f2fs uses index(radix) tree as mapping metadata, its space overhead
is about one thousandth of the data, so can you please try above
calculation?

Thanks,

>> -    filesizekb=$((avail / 1024 - 512))
>> +    filesizekb=$((avail / 1024 - $leave))
>>       $XFS_IO_PROG -fc "falloc 0 ${filesizekb}k" $file
>>   }
>>
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Sun Ke June 17, 2021, 6:22 a.m. UTC | #5
在 2021/6/16 21:15, Chao Yu 写道:
> On 2021/6/15 11:28, Sun Ke wrote:
>> to linux-f2fs-devel@lists.sourceforge.net
>>
>> 在 2021/6/11 19:22, Sun Ke 写道:
>>> It failed on f2fs:
>>>       QA output created by 103
>>>      +fallocate: No space left on device
>>>       Silence is golden.
>>>      ...
>>>
>>> Try to leave ~512KB, but during the fallocate, f2fs will be filled.
>>> Provide error prompt: "fallocate: No space left on device".
>>>
>>> Leave more space for f2fs.
>>>
>>> Signed-off-by: Sun Ke <sunke32@huawei.com>
>>> ---
>>> I add some test code
>>>     +       df
>>>             avail=`_get_available_space $SCRATCH_MNT`
>>>     +       echo "avail = ${avail}"
>>>             filesizekb=$((avail / 1024 - 512))
>>>     +       echo "filesizekb = ${filesizekb}"
>>>             $XFS_IO_PROG -fc "falloc 0 ${filesizekb}k" $file
>>>     +       df
>>>     }
>>>
>>> f2fs:
>>>     QA output created by 103
>>>     +Filesystem       1K-blocks       Used   Available Use% Mounted on
>>>     ...
>>>     +/dev/sdb          12580864     553292    12027572   5% /mnt/scratch
>>>     +avail = 12316233728
>>>     +filesizekb = 12027060
>>>     +fallocate: No space left on device
>>>     +Filesystem       1K-blocks       Used   Available Use% Mounted on
>>>     ...
>>>     +/dev/sdb          12580864   12580864           0 100% /mnt/scratch
>>>     Silence is golden.
>>>
>>> xfs:
>>>     QA output created by 103
>>>     +Filesystem       1K-blocks       Used   Available Use% Mounted on
>>>     ...
>>>     +/dev/sdb          12572672     120828    12451844   1% /mnt/scratch
>>>     +avail = 12750688256
>>>     +filesizekb = 12451332
>>>     +Filesystem       1K-blocks       Used   Available Use% Mounted on
>>>     ...
>>>     +/dev/sdb          12572672   12572160         512 100% /mnt/scratch
>>>     Silence is golden.
>>>
>>> ext4:
>>>     QA output created by 103
>>>     +Filesystem       1K-blocks       Used   Available Use% Mounted on
>>>     ...
>>>     +/dev/sdb          12319880      41048    11633304   1% /mnt/scratch
>>>     +avail = 11912503296
>>>     +filesizekb = 11632792
>>>     +Filesystem       1K-blocks       Used   Available Use% Mounted on
>>>     ...
>>>     +/dev/sdb          12319880   11673844         508 100% /mnt/scratch
>>>     Silence is golden.
>>>
>>> after change (f2fs)
>>>     QA output created by 103
>>>     Filesystem       1K-blocks       Used   Available Use% Mounted on
>>>     ...
>>>     /dev/sdb          12580864   12580396         468 100% /tmp/scratch
>>>     Silence is golden.
>>>
>>>   tests/generic/103 | 10 +++++++++-
>>>   1 file changed, 9 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tests/generic/103 b/tests/generic/103
>>> index b22b0159623e..dfce3870781c 100755
>>> --- a/tests/generic/103
>>> +++ b/tests/generic/103
>>> @@ -40,10 +40,18 @@ rm -f $seqres.full
>>>   _consume_freesp()
>>>   {
>>>       file=$1
>>> +    leave=512
>>> +
>>> +    # Try to leave ~512KB, but during the fallocate, f2fs will be 
>>> filled.
>>> +    # Provide error prompt: "fallocate: No space left on device". Leave
>>> +    # more space for f2fs.
>>> +    if [ $FSTYP == "f2fs" ]; then
>>> +        leave=12288
>>> +    fi
>>>       # consume nearly all available space (leave ~512kB)
>>>       avail=`_get_available_space $SCRATCH_MNT`
> 
>          if [ $FSTYP == "f2fs" ]; then
>                  left=$((left + avail / 1024000))
>          fi
> 
> f2fs uses index(radix) tree as mapping metadata, its space overhead
> is about one thousandth of the data, so can you please try above
> calculation?
> 
> Thanks,
I have tried your calculation, it works. I will send v2 patch.

Thanks,
Sun Ke
> 
>>> -    filesizekb=$((avail / 1024 - 512))
>>> +    filesizekb=$((avail / 1024 - $leave))
>>>       $XFS_IO_PROG -fc "falloc 0 ${filesizekb}k" $file
>>>   }
>>>
>>
>>
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> Linux-f2fs-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> .
diff mbox series

Patch

diff --git a/tests/generic/103 b/tests/generic/103
index b22b0159623e..dfce3870781c 100755
--- a/tests/generic/103
+++ b/tests/generic/103
@@ -40,10 +40,18 @@  rm -f $seqres.full
 _consume_freesp()
 {
 	file=$1
+	leave=512
+
+	# Try to leave ~512KB, but during the fallocate, f2fs will be filled.
+	# Provide error prompt: "fallocate: No space left on device". Leave
+	# more space for f2fs.
+	if [ $FSTYP == "f2fs" ]; then
+		leave=12288
+	fi
 
 	# consume nearly all available space (leave ~512kB)
 	avail=`_get_available_space $SCRATCH_MNT`
-	filesizekb=$((avail / 1024 - 512))
+	filesizekb=$((avail / 1024 - $leave))
 	$XFS_IO_PROG -fc "falloc 0 ${filesizekb}k" $file
 }