* [PATCH v2] generic/299: limit max file size
@ 2019-02-18 1:57 Yufen Yu
2019-02-18 3:56 ` Dave Chinner
0 siblings, 1 reply; 3+ messages in thread
From: Yufen Yu @ 2019-02-18 1:57 UTC (permalink / raw)
To: fstests
For some filesystem, such as vfat, the max support file size
is 4G. We limit the max size and let the test go on running.
Signed-off-by: Yufen Yu <yuyufen@huawei.com>
---
common/rc | 9 +++++++++
tests/generic/299 | 5 +++++
2 files changed, 14 insertions(+)
diff --git a/common/rc b/common/rc
index e5da6484..94148029 100644
--- a/common/rc
+++ b/common/rc
@@ -3785,6 +3785,15 @@ _require_scratch_feature()
esac
}
+# get mount point filesystem max file size
+_get_file_max_size()
+{
+ local mnt_point=$1
+
+ bits=`getconf FILESIZEBITS ${mnt_point}`
+ echo "$((2**bits-1))"
+}
+
# The maximum filesystem label length, /not/ including terminating NULL
_label_get_max()
{
diff --git a/tests/generic/299 b/tests/generic/299
index c4d74fc8..175aa6f2 100755
--- a/tests/generic/299
+++ b/tests/generic/299
@@ -33,6 +33,11 @@ NUM_JOBS=$((4*LOAD_FACTOR))
BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
FILE_SIZE=$((BLK_DEV_SIZE * 512))
+# filesystem limit max file size
+max_file_size=$(_get_file_max_size $SCRATCH_MNT)
+FILE_SIZE=$([ $max_file_size -le $FILE_SIZE ] && \
+ echo "$max_file_size" || echo "$FILE_SIZE")
+
cat >$fio_config <<EOF
###########
# $seq test fio activity
--
2.16.2.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] generic/299: limit max file size
2019-02-18 1:57 [PATCH v2] generic/299: limit max file size Yufen Yu
@ 2019-02-18 3:56 ` Dave Chinner
2019-02-18 6:33 ` yuyufen
0 siblings, 1 reply; 3+ messages in thread
From: Dave Chinner @ 2019-02-18 3:56 UTC (permalink / raw)
To: Yufen Yu; +Cc: fstests
On Mon, Feb 18, 2019 at 09:57:41AM +0800, Yufen Yu wrote:
> For some filesystem, such as vfat, the max support file size
> is 4G. We limit the max size and let the test go on running.
>
> Signed-off-by: Yufen Yu <yuyufen@huawei.com>
> ---
> common/rc | 9 +++++++++
> tests/generic/299 | 5 +++++
> 2 files changed, 14 insertions(+)
>
> diff --git a/common/rc b/common/rc
> index e5da6484..94148029 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3785,6 +3785,15 @@ _require_scratch_feature()
> esac
> }
>
> +# get mount point filesystem max file size
> +_get_file_max_size()
> +{
> + local mnt_point=$1
> +
> + bits=`getconf FILESIZEBITS ${mnt_point}`
> + echo "$((2**bits-1))"
> +}
Did you test this?
$ echo "$((2**64-1))"
-1
$
> # The maximum filesystem label length, /not/ including terminating NULL
> _label_get_max()
> {
> diff --git a/tests/generic/299 b/tests/generic/299
> index c4d74fc8..175aa6f2 100755
> --- a/tests/generic/299
> +++ b/tests/generic/299
> @@ -33,6 +33,11 @@ NUM_JOBS=$((4*LOAD_FACTOR))
> BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
> FILE_SIZE=$((BLK_DEV_SIZE * 512))
>
> +# filesystem limit max file size
> +max_file_size=$(_get_file_max_size $SCRATCH_MNT)
> +FILE_SIZE=$([ $max_file_size -le $FILE_SIZE ] && \
> + echo "$max_file_size" || echo "$FILE_SIZE")
> +
It's much easier to read if you use if/then:
max_file_size=$(_get_file_max_size $SCRATCH_MNT)
if [ $max_file_size -lt $FILE_SIZE ]; then
FILE_SIZE=$max_file_size
fi
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] generic/299: limit max file size
2019-02-18 3:56 ` Dave Chinner
@ 2019-02-18 6:33 ` yuyufen
0 siblings, 0 replies; 3+ messages in thread
From: yuyufen @ 2019-02-18 6:33 UTC (permalink / raw)
To: Dave Chinner; +Cc: fstests
On 2019/2/18 11:56, Dave Chinner wrote:
> On Mon, Feb 18, 2019 at 09:57:41AM +0800, Yufen Yu wrote:
>> For some filesystem, such as vfat, the max support file size
>> is 4G. We limit the max size and let the test go on running.
>>
>> Signed-off-by: Yufen Yu <yuyufen@huawei.com>
>> ---
>> common/rc | 9 +++++++++
>> tests/generic/299 | 5 +++++
>> 2 files changed, 14 insertions(+)
>>
>> diff --git a/common/rc b/common/rc
>> index e5da6484..94148029 100644
>> --- a/common/rc
>> +++ b/common/rc
>> @@ -3785,6 +3785,15 @@ _require_scratch_feature()
>> esac
>> }
>>
>> +# get mount point filesystem max file size
>> +_get_file_max_size()
>> +{
>> + local mnt_point=$1
>> +
>> + bits=`getconf FILESIZEBITS ${mnt_point}`
>> + echo "$((2**bits-1))"
>> +}
> Did you test this?
>
> $ echo "$((2**64-1))"
> -1
Sorry for my carelessness.
> $
>
>> # The maximum filesystem label length, /not/ including terminating NULL
>> _label_get_max()
>> {
>> diff --git a/tests/generic/299 b/tests/generic/299
>> index c4d74fc8..175aa6f2 100755
>> --- a/tests/generic/299
>> +++ b/tests/generic/299
>> @@ -33,6 +33,11 @@ NUM_JOBS=$((4*LOAD_FACTOR))
>> BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
>> FILE_SIZE=$((BLK_DEV_SIZE * 512))
>>
>> +# filesystem limit max file size
>> +max_file_size=$(_get_file_max_size $SCRATCH_MNT)
>> +FILE_SIZE=$([ $max_file_size -le $FILE_SIZE ] && \
>> + echo "$max_file_size" || echo "$FILE_SIZE")
>> +
> It's much easier to read if you use if/then:
>
> max_file_size=$(_get_file_max_size $SCRATCH_MNT)
> if [ $max_file_size -lt $FILE_SIZE ]; then
> FILE_SIZE=$max_file_size
> fi
OK.
Yufen
Thanks.
> Cheers,
>
> Dave.
.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-18 6:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-18 1:57 [PATCH v2] generic/299: limit max file size Yufen Yu
2019-02-18 3:56 ` Dave Chinner
2019-02-18 6:33 ` yuyufen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.