FSTests Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] fsx: fix bug where zero range operations never use the keep size flag
@ 2020-03-06 12:35 fdmanana
  2020-03-06 14:53 ` Josef Bacik
  0 siblings, 1 reply; 2+ messages in thread
From: fdmanana @ 2020-03-06 12:35 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Filipe Manana

From: Filipe Manana <fdmanana@suse.com>

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 <fdmanana@suse.com>
---
 ltp/fsx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ltp/fsx.c b/ltp/fsx.c
index 06d08e4e..7f7b7a87 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -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");
-- 
2.11.0


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

* Re: [PATCH] fsx: fix bug where zero range operations never use the keep size flag
  2020-03-06 12:35 [PATCH] fsx: fix bug where zero range operations never use the keep size flag fdmanana
@ 2020-03-06 14:53 ` Josef Bacik
  0 siblings, 0 replies; 2+ messages in thread
From: Josef Bacik @ 2020-03-06 14:53 UTC (permalink / raw)
  To: fdmanana, fstests; +Cc: linux-btrfs, Filipe Manana

On 3/6/20 7:35 AM, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> 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 <fdmanana@suse.com>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-06 12:35 [PATCH] fsx: fix bug where zero range operations never use the keep size flag fdmanana
2020-03-06 14:53 ` Josef Bacik

FSTests Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/fstests/0 fstests/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 fstests fstests/ https://lore.kernel.org/fstests \
		fstests@vger.kernel.org
	public-inbox-index fstests

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.fstests


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git