You've already forked linux-apfs-rw
mirror of
https://github.com/linux-apfs/linux-apfs-rw.git
synced 2026-05-01 15:01:34 -07:00
Re-enable readahead
It appears that readahead has been broken ever since multiple mounts
were introduced in commit 4a6c0e2b77 ("Support simultaneous mount of
multiple volumes"). The performance damage from this regression has been
very nasty. When reading a large file, the driver spends most of the
time sleeping, as it waits for the individual pages to be read.
The problem is that the fake anonymous devices used by each volume still
need to have their backing_dev_info set, especially the ra_pages field
which decides the length of the readahead operations. Follow btrfs and
call super_setup_bdi() from apfs_fill_super(). Cleanup is handled by
->kill_sb(), so no changes are needed there.
To avoid complicated conditional builds, don't make any changes for
kernels below 4.12, which introduced super_setup_bdi(). Of course this
means that those kernels are stuck with lousy read speeds, but they are
all set for EOL in little more than a year, so hopefully nobody will
mind.
Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
This commit is contained in:
+3
-2
@@ -7,8 +7,9 @@ all Apple devices. This module provides a degree of experimental support on
|
||||
Linux.
|
||||
|
||||
It's supposed to work with a range of kernel versions starting at 4.9 or before,
|
||||
but only a few of those have actually been tested. If you run into any problem,
|
||||
please send a report to <linux-apfs@googlegroups.com> or file a github issue at
|
||||
but only a few of those have actually been tested. Also, kernel versions below
|
||||
4.12 will be slower for some operations. If you run into any problem, please
|
||||
send a report to <linux-apfs@googlegroups.com> or file a github issue at
|
||||
https://github.com/eafer/linux-apfs-rw/issues.
|
||||
|
||||
To help test write support, a set of userland tools is also under development.
|
||||
|
||||
@@ -1061,6 +1061,16 @@ static int apfs_fill_super(struct super_block *sb, void *data, int silent)
|
||||
ASSERT(sbi);
|
||||
lockdep_assert_held(&nxs_mutex);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
|
||||
/* This is needed for readahead, so old kernels will be slower */
|
||||
err = super_setup_bdi(sb);
|
||||
if (err)
|
||||
return err;
|
||||
/* This is redundant for kernels 5.10 and above */
|
||||
sb->s_bdi->ra_pages = VM_READAHEAD_PAGES;
|
||||
sb->s_bdi->io_pages = VM_READAHEAD_PAGES;
|
||||
#endif
|
||||
|
||||
sbi->s_uid = INVALID_UID;
|
||||
sbi->s_gid = INVALID_GID;
|
||||
err = parse_options(sb, data);
|
||||
|
||||
Reference in New Issue
Block a user