linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] fsx: add missing file size update on zero range operations
@ 2020-04-08 10:35 fdmanana
  2020-04-17 17:10 ` Brian Foster
  2020-04-19 14:55 ` Eryu Guan
  0 siblings, 2 replies; 10+ messages in thread
From: fdmanana @ 2020-04-08 10:35 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Filipe Manana

From: Filipe Manana <fdmanana@suse.com>

When a zero range operation increases the size of the test file we were
not updating the global variable 'file_size' which tracks the current
size of the test file. This variable is used to for example compute the
offset for a source range of clone, dedupe and copy file range operations.

So just fix it by updating the 'file_size' global variable whenever a zero
range operation does not use the keep size flag and its range goes beyond
the current file size.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 ltp/fsx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ltp/fsx.c b/ltp/fsx.c
index 9d598a4f..fa383c94 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -1212,6 +1212,8 @@ do_zero_range(unsigned offset, unsigned length, int keep_size)
 	}
 
 	end_offset = keep_size ? 0 : offset + length;
+	if (!keep_size && end_offset > file_size)
+		file_size = end_offset;
 
 	if (end_offset > biggest) {
 		biggest = end_offset;
-- 
2.11.0


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

end of thread, other threads:[~2020-04-20 17:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-08 10:35 [PATCH 1/4] fsx: add missing file size update on zero range operations fdmanana
2020-04-17 17:10 ` Brian Foster
2020-04-17 17:20   ` Filipe Manana
2020-04-17 17:26     ` Brian Foster
2020-04-17 17:32       ` Filipe Manana
2020-04-17 17:47         ` Brian Foster
2020-04-17 17:53           ` Filipe Manana
2020-04-17 18:25             ` Brian Foster
2020-04-20 17:07               ` Filipe Manana
2020-04-19 14:55 ` Eryu Guan

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).