Re: [PATCH mmotm] mm: warn on deleting redirtied only if accounted

From: Matthew Wilcox
Date: Thu Mar 03 2022 - 23:39:00 EST


On Thu, Mar 03, 2022 at 08:25:50PM -0800, Hugh Dickins wrote:
> filemap_unaccount_folio() has a WARN_ON_ONCE(folio_test_dirty(folio)).
> It is good to warn of late dirtying on a persistent filesystem, but late
> dirtying on tmpfs can only lose data which is expected to be thrown away;
> and it's a pity if that warning comes ONCE on tmpfs, then hides others
> which really matter. Make it conditional on mapping_cap_writeback().
>
> Cleanup: then folio_account_cleaned() no longer needs to check that
> for itself, and so no longer needs to know the mapping.

At first blush, I like this a lot. Will look more in the morning.