]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
Squashfs: add SEEK_DATA/SEEK_HOLE support
authorPhillip Lougher <phillip@squashfs.org.uk>
Tue, 23 Sep 2025 22:06:52 +0000 (23:06 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 28 Sep 2025 18:36:14 +0000 (11:36 -0700)
commitdec91e7ab10ec465d59144aabe69c01723ddd1c4
treec788c81c88a3387b25ad5162052072e6c8a5605d
parent9ee94bfbe930a1b39df53fa2d7b31141b780eb5a
Squashfs: add SEEK_DATA/SEEK_HOLE support

Add support for SEEK_DATA and SEEK_HOLE lseek() whence values.

These allow much faster searches for holes and data in sparse files, which
can significantly speed up file copying, e.g.

before (GNU coreutils, Debian 13):

cp --sparse=always big-file /

took real 11m58s, user 0m5.764s, sys 11m48s

after:

real 0.047s, user 0.000s, sys 0.027s

Where big-file has a 256 GB hole followed by 47 KB of data.

Link: https://lkml.kernel.org/r/20250923220652.568416-3-phillip@squashfs.org.uk
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/squashfs/file.c
fs/squashfs/inode.c
fs/squashfs/squashfs.h
fs/squashfs/squashfs_fs.h