On Sun, May 02, 2021 at 04:45:19PM -0400, Mike Marshall wrote: > orangefs: implement orangefs_readahead > > mm/readahead.c/read_pages was quite a bit different back > when I put my open-coded readahead logic into orangefs_readpage. > It seemed to work as designed then, it is a trainwreck now. Hey Mike, I happened to have a chance to look at orangefs_readahead today, and I'd like to suggest a minor improvement. It's possible for rac->file to be NULL if the caller doesn't have a struct file. I think that only happens when filesystems call their own readahead routine internally, but in case it might happen from generic code in the future, I recommend you do something like ... - struct file *file = rac->file; - struct inode *inode = file->f_mapping->host; + struct inode *inode = rac->mapping->host; ... - i_pages = &file->f_mapping->i_pages; + i_pages = &rac->mapping->i_pages; ... - inode->i_size, NULL, NULL, file)) < 0) + inode->i_size, NULL, NULL, rac->file)) < 0) (i have this change all tangled up with some other changes in my tree, so no easy patch to apply, sorry)