mirror of https://github.com/torvalds/linux.git
fs/ntfs3: disable readahead for compressed files
Reading large compressed files is extremely slow when readahead is enabled. For example, reading a 4 GB XPRESS-4K compressed file (compression ratio ≈ 4:1) takes about 230 minutes with readahead enabled, but only around 3 minutes when readahead is disabled. The issue was first observed in January 2025 and is reproducible with large compressed NTFS files. Disabling readahead for compressed files avoids this performance regression, although this may not be the ideal long-term fix. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
parent
9948dcb2f7
commit
1ff28f36eb
|
|
@ -325,9 +325,14 @@ static int ntfs_file_mmap_prepare(struct vm_area_desc *desc)
|
|||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
if (is_compressed(ni) && rw) {
|
||||
ntfs_inode_warn(inode, "mmap(write) compressed not supported");
|
||||
return -EOPNOTSUPP;
|
||||
if (is_compressed(ni)) {
|
||||
if (rw) {
|
||||
ntfs_inode_warn(inode,
|
||||
"mmap(write) compressed not supported");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
/* Turn off readahead for compressed files. */
|
||||
file->f_ra.ra_pages = 0;
|
||||
}
|
||||
|
||||
if (rw) {
|
||||
|
|
@ -884,9 +889,14 @@ static ssize_t ntfs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
if (is_compressed(ni) && (iocb->ki_flags & IOCB_DIRECT)) {
|
||||
ntfs_inode_warn(inode, "direct i/o + compressed not supported");
|
||||
return -EOPNOTSUPP;
|
||||
if (is_compressed(ni)) {
|
||||
if (iocb->ki_flags & IOCB_DIRECT) {
|
||||
ntfs_inode_warn(
|
||||
inode, "direct i/o + compressed not supported");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
/* Turn off readahead for compressed files. */
|
||||
file->f_ra.ra_pages = 0;
|
||||
}
|
||||
|
||||
return generic_file_read_iter(iocb, iter);
|
||||
|
|
@ -906,6 +916,11 @@ static ssize_t ntfs_file_splice_read(struct file *in, loff_t *ppos,
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
if (is_compressed(ntfs_i(inode))) {
|
||||
/* Turn off readahead for compressed files. */
|
||||
in->f_ra.ra_pages = 0;
|
||||
}
|
||||
|
||||
return filemap_splice_read(in, ppos, pipe, len, flags);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue