All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] generic/033: Check that the 'fzero' operations supports KEEP_SIZE
@ 2025-04-24 19:57 Anna Schumaker
  2025-04-24 21:36 ` Darrick J. Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Anna Schumaker @ 2025-04-24 19:57 UTC (permalink / raw)
  To: linux-nfs, fstests; +Cc: anna

From: Anna Schumaker <anna.schumaker@oracle.com>

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@oracle.com>
---
 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"
 
 _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] generic/033: Check that the 'fzero' operations supports KEEP_SIZE
  2025-04-24 19:57 [PATCH] generic/033: Check that the 'fzero' operations supports KEEP_SIZE Anna Schumaker
@ 2025-04-24 21:36 ` Darrick J. Wong
  2025-04-25 11:44   ` Zorro Lang
  0 siblings, 1 reply; 4+ messages in thread
From: Darrick J. Wong @ 2025-04-24 21:36 UTC (permalink / raw)
  To: Anna Schumaker; +Cc: linux-nfs, fstests

On Thu, Apr 24, 2025 at 03:57:30PM -0400, Anna Schumaker wrote:
> From: Anna Schumaker <anna.schumaker@oracle.com>
> 
> 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@oracle.com>
> ---
>  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.

--D

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] generic/033: Check that the 'fzero' operations supports KEEP_SIZE
  2025-04-24 21:36 ` Darrick J. Wong
@ 2025-04-25 11:44   ` Zorro Lang
  2025-04-25 15:22     ` Anna Schumaker
  0 siblings, 1 reply; 4+ messages in thread
From: Zorro Lang @ 2025-04-25 11:44 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Anna Schumaker, linux-nfs, fstests

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@oracle.com>
> > 
> > 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@oracle.com>
> > ---
> >  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
> > 
> > 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] generic/033: Check that the 'fzero' operations supports KEEP_SIZE
  2025-04-25 11:44   ` Zorro Lang
@ 2025-04-25 15:22     ` Anna Schumaker
  0 siblings, 0 replies; 4+ messages in thread
From: Anna Schumaker @ 2025-04-25 15:22 UTC (permalink / raw)
  To: Zorro Lang, Darrick J. Wong; +Cc: Anna Schumaker, linux-nfs, fstests



On 4/25/25 7:44 AM, Zorro Lang wrote:
> 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@oracle.com>
>>>
>>> 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@oracle.com>
>>> ---
>>>  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 ?

I quickly tested this with my NFS ZERO_RANGE patch, and didn't have
any problems. I'll send a v2 removing the "-k" argument in a few
minutes!

Anna

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-25 15:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24 19:57 [PATCH] generic/033: Check that the 'fzero' operations supports KEEP_SIZE Anna Schumaker
2025-04-24 21:36 ` Darrick J. Wong
2025-04-25 11:44   ` Zorro Lang
2025-04-25 15:22     ` Anna Schumaker

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.