fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: fdmanana@kernel.org
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org, Filipe Manana <fdmanana@suse.com>
Subject: [PATCH] fsx: fix bug where zero range operations never use the keep size flag
Date: Fri,  6 Mar 2020 12:35:17 +0000	[thread overview]
Message-ID: <20200306123517.16729-1-fdmanana@kernel.org> (raw)

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


             reply	other threads:[~2020-03-06 12:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-06 12:35 fdmanana [this message]
2020-03-06 14:53 ` [PATCH] fsx: fix bug where zero range operations never use the keep size flag Josef Bacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200306123517.16729-1-fdmanana@kernel.org \
    --to=fdmanana@kernel.org \
    --cc=fdmanana@suse.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).