Skip to content

Commit

Permalink
Use generic_file_read_iter if pages are mapped
Browse files Browse the repository at this point in the history
Proof-of-concept for speeding up mmapped reads.

Signed-off-by: Robert Evans <evansr@google.com>
  • Loading branch information
rrevans committed Mar 28, 2024
1 parent 5f4062d commit df6800f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions module/os/linux/zfs/zpl_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,13 @@ zpl_iter_read(struct kiocb *kiocb, struct iov_iter *to)
crhold(cr);
cookie = spl_fstrans_mark();

#if defined(HAVE_FILEMAP_RANGE_HAS_PAGE)
if (zn_has_cached_data(ITOZ(filp->f_mapping->host), kiocb->ki_pos,
kiocb->ki_pos + count - 1)) {
return (generic_file_read_iter(kiocb, to));
}
#endif

int error = -zfs_read(ITOZ(filp->f_mapping->host), &uio,
filp->f_flags | zfs_io_flags(kiocb), cr);

Expand Down

0 comments on commit df6800f

Please sign in to comment.