summaryrefslogtreecommitdiff
path: root/fs/squashfs/inode.c
diff options
context:
space:
mode:
authorPhillip Lougher <phillip@squashfs.org.uk>2025-09-23 23:06:52 +0100
committerAndrew Morton <akpm@linux-foundation.org>2025-09-28 11:36:14 -0700
commitdec91e7ab10ec465d59144aabe69c01723ddd1c4 (patch)
treec788c81c88a3387b25ad5162052072e6c8a5605d /fs/squashfs/inode.c
parent9ee94bfbe930a1b39df53fa2d7b31141b780eb5a (diff)
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>
Diffstat (limited to 'fs/squashfs/inode.c')
-rw-r--r--fs/squashfs/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/squashfs/inode.c b/fs/squashfs/inode.c
index 8f425dbf9052..ddc65d006063 100644
--- a/fs/squashfs/inode.c
+++ b/fs/squashfs/inode.c
@@ -168,7 +168,7 @@ int squashfs_read_inode(struct inode *inode, long long ino)
}
set_nlink(inode, 1);
- inode->i_fop = &generic_ro_fops;
+ inode->i_fop = &squashfs_file_operations;
inode->i_mode |= S_IFREG;
inode->i_blocks = ((inode->i_size - 1) >> 9) + 1;
squashfs_i(inode)->fragment_block = frag_blk;
@@ -222,7 +222,7 @@ int squashfs_read_inode(struct inode *inode, long long ino)
xattr_id = le32_to_cpu(sqsh_ino->xattr);
set_nlink(inode, le32_to_cpu(sqsh_ino->nlink));
inode->i_op = &squashfs_inode_ops;
- inode->i_fop = &generic_ro_fops;
+ inode->i_fop = &squashfs_file_operations;
inode->i_mode |= S_IFREG;
inode->i_blocks = (inode->i_size -
le64_to_cpu(sqsh_ino->sparse) + 511) >> 9;