Re: [PATCH 1/5] commom/rc: define function _get_max_file_size

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



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@xxxxxxxxxx>
> > ---
> >  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



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux