public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] punch-alternating: prevent punching all extents
@ 2025-12-21 10:24 cem
  2025-12-31 18:46 ` Zorro Lang
  0 siblings, 1 reply; 5+ messages in thread
From: cem @ 2025-12-21 10:24 UTC (permalink / raw)
  To: zlang; +Cc: linux-xfs, djwong, fstests

From: Carlos Maiolino <cem@kernel.org>

If by any chance the punch size is >= the interval, we end up punching
everything, zeroing out the file.

As this is not a tool to dealloc the whole file, so force the user to
pass a configuration that won't cause it to happen.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
---
 src/punch-alternating.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/punch-alternating.c b/src/punch-alternating.c
index d2bb4b6a2276..c555b48d8591 100644
--- a/src/punch-alternating.c
+++ b/src/punch-alternating.c
@@ -88,6 +88,11 @@ int main(int argc, char *argv[])
 		usage(argv[0]);
 	}
 
+	if (size >= interval) {
+		printf("Interval must be > size\n");
+		usage(argv[0]);
+	}
+
 	if (optind != argc - 1)
 		usage(argv[0]);
 
-- 
2.52.0


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

end of thread, other threads:[~2026-01-05  9:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-21 10:24 [PATCH] punch-alternating: prevent punching all extents cem
2025-12-31 18:46 ` Zorro Lang
2026-01-02 13:36   ` Carlos Maiolino
2026-01-02 15:43     ` Zorro Lang
2026-01-05  9:51       ` Carlos Maiolino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox