Re: [PATCH v2] ubifs: fix page_count in ->ubifs_migrate_page()

From: Richard Weinberger
Date: Thu Dec 13 2018 - 17:08:14 EST


Am Donnerstag, 13. Dezember 2018, 23:00:00 CET schrieb Kirill A. Shutemov:
> > Let's wait a few days to give Kirill a chance to review, then I'll apply the patch.
>
> I don't remmeber much context now...
>
> Could you remind me why ubifs doesn't take additional pin when sets
> PG_private?

Because it does not use set_page_private(), it just sets the flag for
internal accounting purposes.

>From UBIFS docs:
* UBIFS uses 2 page flags: @PG_private and @PG_checked. @PG_private is set if
* the page is dirty and is used for optimization purposes - dirty pages are
* not budgeted so the flag shows that 'ubifs_write_end()' should not release
* the budget for this page. The @PG_checked flag is set if full budgeting is
* required for the page e.g., when it corresponds to a file hole or it is
* beyond the file size. The budgeting is done in 'ubifs_write_begin()', because
* it is OK to fail in this function, and the budget is released in
* 'ubifs_write_end()'. So the @PG_private and @PG_checked flags carry
* information about how the page was budgeted, to make it possible to release
* the budget properly.

> Migration is not the only place where the additional pin is implied.
> See all users of page_has_private() helper. Notably reclaim path.

Hmmm, I need to dig into that.
I this is a problem then f2fs suffers from it too.
At least from what I can tell from reading f2fs_migrate_page().

Thanks,
//richard