]> git.ipfire.org Git - thirdparty/util-linux.git/commit
hexdump: add FIEMAP-based sparse file optimization
authorWanBingjiang <wanbingjiang@webray.com.cn>
Fri, 30 Jan 2026 05:48:24 +0000 (13:48 +0800)
committerWanBingjiang <wanbingjiang@webray.com.cn>
Fri, 30 Jan 2026 07:16:38 +0000 (15:16 +0800)
commit03d14f5bc33d82f54578b384437101846622b958
treeb93622985701f87775c982b9a5322f4282474755
parentdb6c2b8fe4520090f0cf903d6fae1ca24a662d87
hexdump: add FIEMAP-based sparse file optimization

Use Linux FIEMAP ioctl to detect sparse file holes and skip reading
them. This significantly improves performance when dumping large
sparse files by avoiding unnecessary disk I/O for hole regions.

Key changes:
- Add fiemap, in_sparse_hole, and region_end fields to struct hexdump
- Use check_hole() with cached region boundaries to minimize syscalls
- Only skip holes when vflag==DUP to preserve correct "*" output
- Distinguish real sparse holes from duplicate data in regular files
text-utils/hexdump-display.c
text-utils/hexdump.h