All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] define common _get_max_file_size function
@ 2019-02-20  1:59 Yufen Yu
  2019-02-20  1:59 ` [PATCH 1/5] commom/rc: define function _get_max_file_size Yufen Yu
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Yufen Yu @ 2019-02-20  1:59 UTC (permalink / raw)
  To: fstests

We define a new function _get_max_file_size, and let generic/299,
351, 349 use this.

Yufen Yu (5):
  commom/rc: define function _get_max_file_size
  generic/299: limit max file size
  generic/351: use the common function _get_max_file_size
  generic/349: use the common function _get_max_file_size
  generic/350: use the common function _get_max_file_size

 common/rc         | 23 +++++++++++++++++++++++
 tests/generic/299 |  5 +++++
 tests/generic/349 | 13 ++-----------
 tests/generic/350 | 13 ++-----------
 tests/generic/351 | 13 ++-----------
 5 files changed, 34 insertions(+), 33 deletions(-)

-- 
2.16.2.dirty

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

* [PATCH 1/5] commom/rc: define function _get_max_file_size
  2019-02-20  1:59 [PATCH 0/5] define common _get_max_file_size function Yufen Yu
@ 2019-02-20  1:59 ` Yufen Yu
  2019-02-20  3:12   ` Eric Biggers
  2019-02-20  1:59 ` [PATCH 2/5] generic/299: limit max file size Yufen Yu
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Yufen Yu @ 2019-02-20  1:59 UTC (permalink / raw)
  To: fstests

Define a new function _get_max_file_size to return
the max file size supported by the special filesystem.

Signed-off-by: Yufen Yu <yuyufen@huawei.com>
---
 common/rc | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/common/rc b/common/rc
index e5da6484..10ab497d 100644
--- a/common/rc
+++ b/common/rc
@@ -3785,6 +3785,29 @@ _require_scratch_feature()
 	esac
 }
 
+# get filesystem max file size
+_get_max_file_size()
+{
+	case $FSTYP in
+	vfat|jffs2|romfs)
+		echo $((2**32-1)) # 0xFFFFFFFF
+		;;
+	*) # MAX_LFS_FILESIZE
+		case "$(getconf LONG_BIT)" in
+		"32")
+			echo $(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1))
+			;;
+		"64")
+			echo "9223372036854775807"
+			;;
+		*)
+			_fail "sizeof(long) == $(getconf LONG_BIT)?"
+			;;
+		esac
+		;;
+	esac
+}
+
 # The maximum filesystem label length, /not/ including terminating NULL
 _label_get_max()
 {
-- 
2.16.2.dirty

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

* [PATCH 2/5] generic/299: limit max file size
  2019-02-20  1:59 [PATCH 0/5] define common _get_max_file_size function Yufen Yu
  2019-02-20  1:59 ` [PATCH 1/5] commom/rc: define function _get_max_file_size Yufen Yu
@ 2019-02-20  1:59 ` Yufen Yu
  2019-02-20  1:59 ` [PATCH 3/5] generic/351: use the common function _get_max_file_size Yufen Yu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Yufen Yu @ 2019-02-20  1:59 UTC (permalink / raw)
  To: fstests

We limit the max size and let the test go on running.

Signed-off-by: Yufen Yu <yuyufen@huawei.com>
---
 tests/generic/299 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/generic/299 b/tests/generic/299
index c4d74fc8..4d474032 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))
 
+max_file_size=$(_get_max_file_size)
+if [ $max_file_size -lt $FILE_SIZE ]; then
+	FILE_SIZE=$max_file_size
+fi
+
 cat >$fio_config <<EOF
 ###########
 # $seq test fio activity
-- 
2.16.2.dirty

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

* [PATCH 3/5] generic/351: use the common function _get_max_file_size
  2019-02-20  1:59 [PATCH 0/5] define common _get_max_file_size function Yufen Yu
  2019-02-20  1:59 ` [PATCH 1/5] commom/rc: define function _get_max_file_size Yufen Yu
  2019-02-20  1:59 ` [PATCH 2/5] generic/299: limit max file size Yufen Yu
@ 2019-02-20  1:59 ` Yufen Yu
  2019-02-20  1:59 ` [PATCH 4/5] generic/349: " Yufen Yu
  2019-02-20  1:59 ` [PATCH 5/5] generic/350: " Yufen Yu
  4 siblings, 0 replies; 8+ messages in thread
From: Yufen Yu @ 2019-02-20  1:59 UTC (permalink / raw)
  To: fstests

We use common function _get_max_file_size to get the max
file size supported by the filesystems and let the code
be clean.

Signed-off-by: Yufen Yu <yuyufen@huawei.com>
---
 tests/generic/351 | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/tests/generic/351 b/tests/generic/351
index e326dca1..5fd7c303 100755
--- a/tests/generic/351
+++ b/tests/generic/351
@@ -62,17 +62,8 @@ $XFS_IO_PROG -c "fpunch 512 512" $dev
 
 echo "Zero range past MAX_LFS_FILESIZE keep size"
 # zod = MAX_LFS_FILESIZE
-case "$(getconf LONG_BIT)" in
-"32")
-	zod=$(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1))
-	;;
-"64")
-	zod=9223372036854775807
-	;;
-*)
-	_fail "sizeof(long) == $(getconf LONG_BIT)?"
-	;;
-esac
+zod=$(_get_max_file_size)
+
 $XFS_IO_PROG -c "fzero -k 512k $zod" $dev
 
 echo "Zero range past MAX_LFS_FILESIZE"
-- 
2.16.2.dirty

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

* [PATCH 4/5] generic/349: use the common function _get_max_file_size
  2019-02-20  1:59 [PATCH 0/5] define common _get_max_file_size function Yufen Yu
                   ` (2 preceding siblings ...)
  2019-02-20  1:59 ` [PATCH 3/5] generic/351: use the common function _get_max_file_size Yufen Yu
@ 2019-02-20  1:59 ` Yufen Yu
  2019-02-20  1:59 ` [PATCH 5/5] generic/350: " Yufen Yu
  4 siblings, 0 replies; 8+ messages in thread
From: Yufen Yu @ 2019-02-20  1:59 UTC (permalink / raw)
  To: fstests

We use common function _get_max_file_size to get the max
file size supported by the filesystems and let the code
be clean.

Signed-off-by: Yufen Yu <yuyufen@huawei.com>
---
 tests/generic/349 | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/tests/generic/349 b/tests/generic/349
index f01f817d..1e76b6ef 100755
--- a/tests/generic/349
+++ b/tests/generic/349
@@ -50,17 +50,8 @@ md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"
 
 echo "Zero range to MAX_LFS_FILESIZE"
 # zod = MAX_LFS_FILESIZE
-case "$(getconf LONG_BIT)" in
-"32")
-	zod=$(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1))
-	;;
-"64")
-	zod=9223372036854775807
-	;;
-*)
-	_fail "sizeof(long) == $(getconf LONG_BIT)?"
-	;;
-esac
+zod=$(_get_max_file_size)
+
 $XFS_IO_PROG -c "fzero -k 0 $zod" $dev
 
 echo "Check contents"
-- 
2.16.2.dirty

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

* [PATCH 5/5] generic/350: use the common function _get_max_file_size
  2019-02-20  1:59 [PATCH 0/5] define common _get_max_file_size function Yufen Yu
                   ` (3 preceding siblings ...)
  2019-02-20  1:59 ` [PATCH 4/5] generic/349: " Yufen Yu
@ 2019-02-20  1:59 ` Yufen Yu
  4 siblings, 0 replies; 8+ messages in thread
From: Yufen Yu @ 2019-02-20  1:59 UTC (permalink / raw)
  To: fstests

We use common function _get_max_file_size to get the max
file size supported by the filesystems and let the code
be clean.

Signed-off-by: Yufen Yu <yuyufen@huawei.com>
---
 tests/generic/350 | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/tests/generic/350 b/tests/generic/350
index 0aea4c09..f1d9887b 100755
--- a/tests/generic/350
+++ b/tests/generic/350
@@ -47,17 +47,8 @@ md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"
 
 echo "Punch to MAX_LFS_FILESIZE"
 # zod = MAX_LFS_FILESIZE
-case "$(getconf LONG_BIT)" in
-"32")
-	zod=$(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1))
-	;;
-"64")
-	zod=9223372036854775807
-	;;
-*)
-	_fail "sizeof(long) == $(getconf LONG_BIT)?"
-	;;
-esac
+zod=$(_get_max_file_size)
+
 $XFS_IO_PROG -c "fpunch 0 $zod" $dev
 
 echo "Check contents"
-- 
2.16.2.dirty

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

* Re: [PATCH 1/5] commom/rc: define function _get_max_file_size
  2019-02-20  1:59 ` [PATCH 1/5] commom/rc: define function _get_max_file_size Yufen Yu
@ 2019-02-20  3:12   ` Eric Biggers
  2019-02-20 13:32     ` Eryu Guan
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Biggers @ 2019-02-20  3:12 UTC (permalink / raw)
  To: Yufen Yu; +Cc: fstests

Hi Yufen,

On Wed, Feb 20, 2019 at 09:59:51AM +0800, Yufen Yu wrote:
> Define a new function _get_max_file_size to return
> the max file size supported by the special filesystem.
> 
> Signed-off-by: Yufen Yu <yuyufen@huawei.com>
> ---
>  common/rc | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/common/rc b/common/rc
> index e5da6484..10ab497d 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3785,6 +3785,29 @@ _require_scratch_feature()
>  	esac
>  }
>  
> +# get filesystem max file size
> +_get_max_file_size()
> +{
> +	case $FSTYP in
> +	vfat|jffs2|romfs)
> +		echo $((2**32-1)) # 0xFFFFFFFF
> +		;;
> +	*) # MAX_LFS_FILESIZE
> +		case "$(getconf LONG_BIT)" in
> +		"32")
> +			echo $(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1))
> +			;;
> +		"64")
> +			echo "9223372036854775807"
> +			;;
> +		*)
> +			_fail "sizeof(long) == $(getconf LONG_BIT)?"
> +			;;
> +		esac
> +		;;
> +	esac
> +}

Why not move get_max_file_size() from tests/generic/485 to here instead?

- Eric

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

* Re: [PATCH 1/5] commom/rc: define function _get_max_file_size
  2019-02-20  3:12   ` Eric Biggers
@ 2019-02-20 13:32     ` Eryu Guan
  0 siblings, 0 replies; 8+ messages in thread
From: Eryu Guan @ 2019-02-20 13:32 UTC (permalink / raw)
  To: Yufen Yu; +Cc: Eric Biggers, fstests

On Tue, Feb 19, 2019 at 07:12:07PM -0800, Eric Biggers wrote:
> Hi Yufen,
> 
> On Wed, Feb 20, 2019 at 09:59:51AM +0800, Yufen Yu wrote:
> > Define a new function _get_max_file_size to return
> > the max file size supported by the special filesystem.
> > 
> > Signed-off-by: Yufen Yu <yuyufen@huawei.com>
> > ---
> >  common/rc | 23 +++++++++++++++++++++++
> >  1 file changed, 23 insertions(+)
> > 
> > diff --git a/common/rc b/common/rc
> > index e5da6484..10ab497d 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -3785,6 +3785,29 @@ _require_scratch_feature()
> >  	esac
> >  }
> >  
> > +# get filesystem max file size
> > +_get_max_file_size()
> > +{
> > +	case $FSTYP in
> > +	vfat|jffs2|romfs)
> > +		echo $((2**32-1)) # 0xFFFFFFFF
> > +		;;
> > +	*) # MAX_LFS_FILESIZE
> > +		case "$(getconf LONG_BIT)" in
> > +		"32")
> > +			echo $(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1))
> > +			;;
> > +		"64")
> > +			echo "9223372036854775807"
> > +			;;

I don't think this is correct. So ext4 always gets (8E-1) as the max
file size on 64bit system in this case, but it actually supports
(16T-4k) file if block size is 4k, and even smaller max file size when
block size is 2k or 1k.

This function is from generic/351, but that's for test against a block
dev not filesystem.

> > +		*)
> > +			_fail "sizeof(long) == $(getconf LONG_BIT)?"
> > +			;;
> > +		esac
> > +		;;
> > +	esac
> > +}
> 
> Why not move get_max_file_size() from tests/generic/485 to here instead?

Agree, the function in generic/485 would be better.

And I think the patchset should be in a single patch, which moves
get_max_file_size() function from generic/485 to common/rc and update
all related tests.

Thanks,
Eryu

> 
> - Eric

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

end of thread, other threads:[~2019-02-20 13:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-20  1:59 [PATCH 0/5] define common _get_max_file_size function Yufen Yu
2019-02-20  1:59 ` [PATCH 1/5] commom/rc: define function _get_max_file_size Yufen Yu
2019-02-20  3:12   ` Eric Biggers
2019-02-20 13:32     ` Eryu Guan
2019-02-20  1:59 ` [PATCH 2/5] generic/299: limit max file size Yufen Yu
2019-02-20  1:59 ` [PATCH 3/5] generic/351: use the common function _get_max_file_size Yufen Yu
2019-02-20  1:59 ` [PATCH 4/5] generic/349: " Yufen Yu
2019-02-20  1:59 ` [PATCH 5/5] generic/350: " Yufen Yu

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.