Re: [PATCH v2 1/3] erofs: get rid of magical Z_EROFS_MAPPING_STAGING

From: Gao Xiang
Date: Tue Dec 08 2020 - 03:30:52 EST


On Tue, Dec 08, 2020 at 04:15:59PM +0800, Chao Yu wrote:
> On 2020/12/7 9:23, Gao Xiang wrote:

...


> > }
> > -static inline bool z_erofs_put_stagingpage(struct list_head *pagepool,
> > - struct page *page)
> > +static inline bool z_erofs_put_shortlivedpage(struct list_head *pagepool,
> > + struct page *page)
> > {
> > - if (!z_erofs_page_is_staging(page))
> > + if (!z_erofs_is_shortlived_page(page))
> > return false;
> > - /* staging pages should not be used by others at the same time */
> > - if (page_ref_count(page) > 1)
> > + /* short-lived pages should not be used by others at the same time */
> > + if (page_ref_count(page) > 1) {
>
> Does this be a possible case?

Add more words about this.... since EROFS uses rolling decompression (which means
the sliding window is limited (e.g. 64k, but some vendors adjust it to 12k for
example ) even though the uncompressed size is too large (e.g. 128k)), and by
using get_page(), vmap(), and z_erofs_put_shortlivedpage() to free such usage.
Since shortlivedpages won't share with other parallel thread, so it's safe to
just like this to decrease page count (it means how many shared get_page()
before) and recycle to pagepool (on the last reference for later use.)

Thanks,
Gao Xiang