On Sat, Sep 10, 2022 at 08:50:54AM +0200, Christoph Hellwig wrote: > @@ -480,11 +487,14 @@ static inline int ra_alloc_folio(struct readahead_control *ractl, pgoff_t index, > if (index == mark) > folio_set_readahead(folio); > err = filemap_add_folio(ractl->mapping, folio, index, gfp); > - if (err) > + if (err) { > folio_put(folio); > - else > - ractl->_nr_pages += 1UL << order; > - return err; > + return err; > + } > + > + ractl->_nr_pages += 1UL << order; > + ractl->_workingset = folio_test_workingset(folio); I don't have time to look at this properly right now (about to catch a bus to the plane), but I think this should be |=, not =?