All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <guaneryu@gmail.com>
To: Yufen Yu <yuyufen@huawei.com>
Cc: Eric Biggers <ebiggers@kernel.org>, fstests@vger.kernel.org
Subject: Re: [PATCH 1/5] commom/rc: define function _get_max_file_size
Date: Wed, 20 Feb 2019 21:32:38 +0800	[thread overview]
Message-ID: <20190220133238.GB2713@desktop> (raw)
In-Reply-To: <20190220031206.GA672@sol.localdomain>

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

  reply	other threads:[~2019-02-20 13:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=20190220133238.GB2713@desktop \
    --to=guaneryu@gmail.com \
    --cc=ebiggers@kernel.org \
    --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 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.