On Fri, Aug 29, 2025 at 4:58 PM Joanne Koong <joannelkoong@xxxxxxxxx> wrote: > > diff --git a/fs/fuse/file.c b/fs/fuse/file.c > index bdfb13cdee4b..1659603f4cb6 100644 > --- a/fs/fuse/file.c > +++ b/fs/fuse/file.c > + > +static int fuse_handle_readahead(struct folio *folio, > + struct fuse_fill_read_data *data, loff_t pos, > + size_t len) > +{ > + struct fuse_io_args *ia = data->ia; > + size_t off = offset_in_folio(folio, pos); > + struct fuse_conn *fc = data->fc; > + struct fuse_args_pages *ap; > + > + if (ia && fuse_folios_need_send(fc, pos, len, &ia->ap, data->nr_bytes, > + false)) { > + fuse_send_readpages(ia, data->file, data->nr_bytes, > + fc->async_read); > + data->nr_bytes = 0; > + ia = NULL; > + } > + if (!ia) { > + struct readahead_control *rac = data->rac; > + unsigned nr_pages = min(fc->max_pages, readahead_count(rac)); This should also be constrained by "fc->max_read / PAGE_SIZE". Will fix this up for v2. > + > + if (fc->num_background >= fc->congestion_threshold && > + rac->ra->async_size >= readahead_count(rac)) > + /* > + * Congested and only async pages left, so skip the > + * rest. > + */ > + return -EAGAIN; > + > + data->ia = fuse_io_alloc(NULL, nr_pages); > + if (!data->ia) > + return -ENOMEM; > + ia = data->ia; > + } > + folio_get(folio); > + ap = &ia->ap; > + ap->folios[ap->num_folios] = folio; > + ap->descs[ap->num_folios].offset = off; > + ap->descs[ap->num_folios].length = len; > + data->nr_bytes += len; > + ap->num_folios++; > + > + return 0; > +} > +