Re: Re: [PATCH 1/2] generic/219: use filesystem blocksize while calculating the file size

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

 



On Thu, Oct 24, 2024 at 11:19:10AM -0700, Darrick J. Wong wrote:
> On Thu, Oct 24, 2024 at 01:23:10PM +0200, Pankaj Raghav wrote:
> > generic/219 was failing for XFS with 32k and 64k blocksize. Even though
> > we do only 48k IO, XFS will allocate blocks rounded to the nearest
> > blocksize.
> > 
> > Signed-off-by: Pankaj Raghav <p.raghav@xxxxxxxxxxx>
> > ---
> >  tests/generic/219 | 18 +++++++++++++++---
> >  1 file changed, 15 insertions(+), 3 deletions(-)
> > 
> > diff --git a/tests/generic/219 b/tests/generic/219
> > index 940b902e..d72aa745 100755
> > --- a/tests/generic/219
> > +++ b/tests/generic/219
> > @@ -49,12 +49,24 @@ check_usage()
> >  	fi
> >  }
> >  
> > +_round_up_to_fs_blksz()
> > +{
> > +	local n=$1
> > +	local bs=$(_get_file_block_size "$SCRATCH_MNT")
> > +	local bs_kb=$(( bs >> 10 ))
> > +
> > +	echo $(( (n + bs_kb - 1) & ~(bs_kb - 1) ))
> 
> Nit: you can divide here, right?

No. I think you are talking about DIV_ROUND_UP(). We are doing a
round_up operation here.

We should get 64k as sz for bs 32k and 64k.

round_up(48k, 32k/64k) = 64k

> 
> 	echo $(( (n + bs_kb - 1) / bs_kb ))
> 
> The rest seems fine.
> 
> --D
> 
> > +}
> > +
> >  test_accounting()
> >  {
> > -	echo "### some controlled buffered, direct and mmapd IO (type=$type)"
> > -	echo "--- initiating parallel IO..." >>$seqres.full
> >  	# Small ios here because ext3 will account for indirect blocks too ...
> >  	# 48k will fit w/o indirect for 4k blocks (default blocksize)
> > +	io_sz=$(_round_up_to_fs_blksz 48)
> > +	sz=$(( io_sz * 3 ))
> > +
> > +	echo "### some controlled buffered, direct and mmapd IO (type=$type)"
> > +	echo "--- initiating parallel IO..." >>$seqres.full
> >  	$XFS_IO_PROG -c 'pwrite 0 48k' -c 'fsync' \
> >  					$SCRATCH_MNT/buffer >>$seqres.full 2>&1 &
> >  	$XFS_IO_PROG -c 'pwrite 0 48k' -d \
> > @@ -73,7 +85,7 @@ test_accounting()
> >  	else
> >  		id=$qa_group
> >  	fi
> > -	repquota -$type $SCRATCH_MNT | grep "^$id" | check_usage 144 3
> > +	repquota -$type $SCRATCH_MNT | grep "^$id" | check_usage $sz 3
> >  }
> >  
> >  
> > -- 
> > 2.44.1
> > 
> > 

-- 
Pankaj Raghav




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux