diff mbox series

generic/299: limit max file size

Message ID 20190216120717.114983-1-yuyufen@huawei.com (mailing list archive)
State New, archived
Headers show
Series generic/299: limit max file size | expand

Commit Message

Yufen Yu Feb. 16, 2019, 12:07 p.m. UTC
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         | 13 +++++++++++++
 tests/generic/299 |  8 ++++++++
 2 files changed, 21 insertions(+)

Comments

Dave Chinner Feb. 17, 2019, 10:29 p.m. UTC | #1
On Sat, Feb 16, 2019 at 08:07:17PM +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.

Can't this be probed?

ext3/xfs/ext4/btrfs/etc:

$ getconf FILESIZEBITS /
64
$

vfat:

$ getconf FILESIZEBITS /mnt/scratch
32
$

Cheers,

Dave.
Yufen Yu Feb. 18, 2019, 1:51 a.m. UTC | #2
On 2019/2/18 6:29, Dave Chinner wrote:
> On Sat, Feb 16, 2019 at 08:07:17PM +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.
> Can't this be probed?
>
> ext3/xfs/ext4/btrfs/etc:
>
> $ getconf FILESIZEBITS /
> 64
> $
>
> vfat:
>
> $ getconf FILESIZEBITS /mnt/scratch
> 32
> $
>
> Cheers,
>
> Dave.
Thanks a lot for your suggestion. I will send v2.
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index d7687a64..0a8f3d07 100644
--- a/common/rc
+++ b/common/rc
@@ -3889,6 +3889,19 @@  _require_scratch_feature()
 	esac
 }
 
+_get_file_max_size()
+{
+	case $FSTYP in
+	vfat|jffs2)
+		echo $((2**32-1)) #0xffffffff
+		;;
+	*)
+		echo "0"
+		;;
+	esac
+
+}
+
 # The maximum filesystem label length, /not/ including terminating NULL
 _label_get_max()
 {
diff --git a/tests/generic/299 b/tests/generic/299
index c4d74fc8..5d462204 100755
--- a/tests/generic/299
+++ b/tests/generic/299
@@ -33,6 +33,14 @@  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)
+if [ $max_file_size -ne 0 ]
+then
+	FILE_SIZE=$([ $max_file_size -le $FILE_SIZE ] && \
+		echo "$max_file_size" || echo "$FILE_SIZE")
+fi
+
 cat >$fio_config <<EOF
 ###########
 # $seq test fio activity