Re: [PATCH] f2fs: Support enhanced hot/cold data separation for f2fs

From: Matthew Wilcox
Date: Wed Nov 30 2022 - 10:18:53 EST


On Wed, Nov 30, 2022 at 08:48:04PM +0800, Yangtao Li wrote:
> Hi,
>
> > Thanks for reviewing this. I think the real solution to this is
> > that f2fs should be using large folios. That way, the page cache
> > will keep track of dirtiness on a per-folio basis, and if your folios
> > are at least as large as your cluster size, you won't need to do the
> > f2fs_prepare_compress_overwrite() dance. And you'll get at least fifteen
> > dirty folios per call instead of fifteen dirty pages, so your costs will
> > be much lower.
> >
> > Is anyone interested in doing the work to convert f2fs to support
> > large folios? I can help, or you can look at the work done for XFS,
> > AFS and a few other filesystems.
>
> Seems like an interesting job. Not sure if I can be of any help.
> What needs to be done currently to support large folio?
>
> Are there any roadmaps and reference documents.

>From a filesystem point of view, you need to ensure that you handle folios
larger than PAGE_SIZE correctly. The easiest way is to spread the use
of folios throughout the filesystem. For example, today the first thing
we do in f2fs_read_data_folio() is convert the folio back into a page.
That works because f2fs hasn't told the kernel that it supports large
folios, so the VFS won't create large folios for it.

It's a lot of subtle things. Here's an obvious one:
zero_user_segment(page, 0, PAGE_SIZE);
There's a folio equivalent that will zero an entire folio.

But then there is code which assumes the number of blocks per page (maybe
not in f2fs?) and so on. Every filesystem will have its own challenges.

One way to approach this is to just enable large folios (see commit
6795801366da or 8549a26308f9) and see what breaks when you run xfstests
over it. Probably quite a lot!