Re: [RFC PATCH 3/3] fb_defio: do not use deprecated page->mapping, index fields
From: Matthew Wilcox
Date: Wed Jan 08 2025 - 12:33:13 EST
On Wed, Jan 08, 2025 at 04:18:42PM +0000, Lorenzo Stoakes wrote:
> @@ -280,7 +269,10 @@ static void fb_deferred_io_work(struct work_struct *work)
> struct folio *folio = page_folio(pageref->page);
>
> folio_lock(folio);
> - folio_mkclean(folio);
> + rmap_wrprotect_file_page(fbdefio->mapping,
> + pageref->offset >> PAGE_SHIFT,
> + compound_nr(pageref->page),
> + page_to_pfn(pageref->page));
> folio_unlock(folio);
Why do we need to lock the folio? (since this isn't necessarily a
folio) Also, do we need compound_nr() here? I _think_ for defio,
the number of pages allocated per object are fixed, so this should be
an fbdefio->nr_pages field?
(something that's always troubled me about compound_nr() is that it
returns 1 for tail pages and the number you actually expect for head
pages)