fsx: fix bug where zero range operations never use the keep size flag
PATCH 1/1 fsx: fix bug where zero range operations never use the keep size flag
From: Filipe Manana <[email protected]>
We are never using the FALLOC_FL_KEEP_SIZE flag for zero range operations even when we intend to use it. So fix it by setting that flag for the call to fallocate(2) if the 'keep_size' parameter is true.
Signed-off-by Filipe Manana <[email protected]>
--- ltp/fsx.c | 3 +++ 1 file changed, 3 insertions(+)
ltp/fsx.c +3 -0
@@ -1199,6 +1199,9 @@ do_zero_range(unsigned offset, unsigned length, int keep_size)unsigned end_offset;int mode =FALLOC_FL_ZERO_RANGE ; +if (keep_size) + mode |=FALLOC_FL_KEEP_SIZE ; +if (length ==0 ) {if (!quiet && testcalls > simulatedopcount)prt ("skipping zero length zero range\n" );
Signature · 1 line
2.11.0
Quoted 7 lines · On 3/6/20 7:35 AM, [email protected] wrote:
From: Filipe Manana <[email protected]>
We are never using the
FALLOC_FL_KEEP_SIZEflag for zero range operations even when we intend to use it. So fix it by setting that flag for the call to fallocate(2) if the 'keep_size' parameter is true.Signed-off-by Filipe Manana <[email protected]>
Reviewed-by Josef Bacik <[email protected]>
Thanks,
Josef