lkml.org 
[lkml]   [2021]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 02/28] mm: Add an unlock function for PG_private_2/PG_fscache
On Tue, Mar 16, 2021 at 08:38:00PM +0000, David Howells wrote:
> Matthew Wilcox <willy@infradead.org> wrote:
>
> > So ... a page with both flags cleared should have a refcount of N.
> > A page with one or both flags set should have a refcount of N+1.
> > ...
> > How is a poor filesystem supposed to make that true? Also btrfs has this
> > problem since it uses private_2 for its own purposes.
>
> It's simpler if it's N+2 for both patches set. Btw, patch 13 adds that - and
> possibly that should be merged into an earlier patch.

So ...

static inline int page_has_private(struct page *page)
{
unsigned long flags = page->flags;
return ((flags >> PG_private) & 1) + ((flags >> PG_private_2) & 1);
}

perhaps?

\
 
 \ /
  Last update: 2021-03-17 00:34    [W:0.181 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site