From: Carlos Maiolino Date: Sun, 21 Dec 2025 10:24:50 +0000 (+0100) Subject: punch-alternating: prevent punching all extents X-Git-Tag: v2026.01.05~30 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ffd562ecf44aff10b74c35c6f961614db5198ca9;p=xfstests-dev.git punch-alternating: prevent punching all extents 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 Signed-off-by: Carlos Maiolino Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- diff --git a/src/punch-alternating.c b/src/punch-alternating.c index d2bb4b6a..c555b48d 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]);