On Mon, Apr 28, 2025 at 8:38 AM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > > On Mon, Apr 28, 2025 at 02:59:03AM +0800, Kairui Song wrote: > > folio_index is only needed for mixed usage of page cache and swap > > cache, for pure page cache usage, the caller can just use > > folio->index instead. > > > > It can't be a swap cache folio here. Swap mapping may only call into fs > > through `swap_rw` and that is not supported for fuse. So just drop it > > and use folio->index instead. > > > > uigned-off-by: Kairui Song <kasong@xxxxxxxxxxx> > > Cc: Miklos Szeredi <miklos@xxxxxxxxxx> > > Cc: Joanne Koong <joannelkoong@xxxxxxxxx> > > Cc: Josef Bacik <josef@xxxxxxxxxxxxxx> > > Cc: linux-fsdevel@xxxxxxxxxxxxxxx > > Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx> > > Reviewed-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Thanks for the review. > > > @@ -2349,7 +2349,7 @@ static bool fuse_writepage_need_send(struct fuse_conn *fc, struct folio *folio, > > return true; > > > > /* Discontinuity */ > > - if (data->orig_folios[ap->num_folios - 1]->index + 1 != folio_index(folio)) > > + if (data->orig_folios[ap->num_folios - 1]->index + 1 != folio->index) > > return true; > > This looks like a pre-existing bug. > > - if (data->orig_folios[ap->num_folios - 1]->index + 1 != folio_index(folio)) > + prev_folio = data->orig_folios[ap->num_folios - 1]; > + if (prev_folio->index + folio_nr_pages(prev_folio) != folio->index) > return true; > It seems FUSE does not work with high order folios yet, a lot of allocation and operation here are assuming folio size == PAGE_SIZE. I think I'll just leave it here.