John Groves wrote: > From: John Groves <[email protected]> > > Both fs/dax.c:dax_folio_put() and drivers/dax/fsdev.c: > fsdev_clear_folio_state() (the latter coming in the next commit after this > one) contain nearly identical code to reset a compound DAX folio back to > order-0 pages. Factor this out into a shared helper function. > > The new dax_folio_reset_order() function: > - Clears the folio's mapping and share count > - Resets compound folio state via folio_reset_order() > - Clears PageHead and compound_head for each sub-page > - Restores the pgmap pointer for each resulting order-0 folio > - Returns the original folio order (for callers that need to advance by > that many pages) > > This simplifies fsdev_clear_folio_state() from ~50 lines to ~15 lines while > maintaining the same functionality in both call sites. > > Suggested-by: Jonathan Cameron <[email protected]> > Signed-off-by: John Groves <[email protected]>
Reviewed-by: Ira Weiny <[email protected]> [snip]
