FS/XFS testing framework
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Yufen Yu <yuyufen@huawei.com>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH v2] generic/299: limit max file size
Date: Mon, 18 Feb 2019 14:56:01 +1100	[thread overview]
Message-ID: <20190218035601.GD9805@dastard> (raw)
In-Reply-To: <20190218015741.7996-1-yuyufen@huawei.com>

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

  reply	other threads:[~2019-02-18  3:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-18  1:57 [PATCH v2] generic/299: limit max file size Yufen Yu
2019-02-18  3:56 ` Dave Chinner [this message]
2019-02-18  6:33   ` yuyufen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190218035601.GD9805@dastard \
    --to=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=yuyufen@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox