Re: [PATCH] generic/033: Check that the 'fzero' operations supports KEEP_SIZE

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

 



On Thu, Apr 24, 2025 at 02:36:07PM -0700, Darrick J. Wong wrote:
> On Thu, Apr 24, 2025 at 03:57:30PM -0400, Anna Schumaker wrote:
> > From: Anna Schumaker <anna.schumaker@xxxxxxxxxx>
> > 
> > Otherwise this test will fail on filesystems that implement
> > FALLOC_FL_ZERO_RANGE but not the optional FALLOC_FL_KEEP_SIZE flag.
> > 
> > Signed-off-by: Anna Schumaker <anna.schumaker@xxxxxxxxxx>
> > ---
> >  tests/generic/033 | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tests/generic/033 b/tests/generic/033
> > index a9a9ff5a3431..a33f6add67bf 100755
> > --- a/tests/generic/033
> > +++ b/tests/generic/033
> > @@ -20,7 +20,7 @@ _begin_fstest auto quick rw zero
> >  
> >  # Modify as appropriate.
> >  _require_scratch
> > -_require_xfs_io_command "fzero"
> > +_require_xfs_io_command "fzero" "-k"
> 
> I wonder, does this test even need KEEP_SIZE?  It writes 64MB to the
> file, then it fzeros every other 4k up to (64M-4k), then fzeroes
> everything else.  AFAICT the fzero commands never exceed the file
> size...though I could be wrong.

Hmm... I think you're right, the code logic is:

  bytes=$((64 * 1024))
  $XFS_IO_PROG -f -c "pwrite 0 $bytes" $file
  endoff=$((bytes - 4096))
  for i in $(seq 0 8192 $endoff); do
          $XFS_IO_PROG -c "fzero -k $i 4k" $file
  done
  for i in $(seq 4096 8192 $endoff); do
          $XFS_IO_PROG -c "fzero -k $i 4k" $file
  done

So looks like the offset+len isn't greater than the file size. So we
might can remove the "-k" directly. What do you think ?

Thanks,
Zorro

> 
> --D
> 
> >  
> >  _scratch_mkfs >/dev/null 2>&1
> >  _scratch_mount
> > -- 
> > 2.49.0
> > 
> > 
> 





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux