Skip to content

Commit 24bbd53

Browse files
Trond MyklebustAnna Schumaker
authored andcommitted
filemap: Add a helper for filesystems implementing dropbehind
Add a helper to allow filesystems to attempt to free the 'dropbehind' folio. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Link: https://lore.kernel.org/all/5588a06f6d5a2cf6746828e2d36e7ada668b1739.1745381692.git.trond.myklebust@hammerspace.com/ Reviewed-by: Mike Snitzer <snitzer@kernel.org> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
1 parent cc6ac66 commit 24bbd53

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

include/linux/pagemap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,7 @@ void folio_wait_writeback(struct folio *folio);
12211221
int folio_wait_writeback_killable(struct folio *folio);
12221222
void end_page_writeback(struct page *page);
12231223
void folio_end_writeback(struct folio *folio);
1224+
void folio_end_dropbehind(struct folio *folio);
12241225
void folio_wait_stable(struct folio *folio);
12251226
void __folio_mark_dirty(struct folio *folio, struct address_space *, int warn);
12261227
void folio_account_cleaned(struct folio *folio, struct bdi_writeback *wb);

mm/filemap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,7 +1608,7 @@ static void filemap_end_dropbehind(struct folio *folio)
16081608
* completes. Do that now. If we fail, it's likely because of a big folio -
16091609
* just reset dropbehind for that case and latter completions should invalidate.
16101610
*/
1611-
static void filemap_end_dropbehind_write(struct folio *folio)
1611+
void folio_end_dropbehind(struct folio *folio)
16121612
{
16131613
if (!folio_test_dropbehind(folio))
16141614
return;
@@ -1625,6 +1625,7 @@ static void filemap_end_dropbehind_write(struct folio *folio)
16251625
folio_unlock(folio);
16261626
}
16271627
}
1628+
EXPORT_SYMBOL_GPL(folio_end_dropbehind);
16281629

16291630
/**
16301631
* folio_end_writeback - End writeback against a folio.
@@ -1660,7 +1661,7 @@ void folio_end_writeback(struct folio *folio)
16601661
if (__folio_end_writeback(folio))
16611662
folio_wake_bit(folio, PG_writeback);
16621663

1663-
filemap_end_dropbehind_write(folio);
1664+
folio_end_dropbehind(folio);
16641665
acct_reclaim_writeback(folio);
16651666
folio_put(folio);
16661667
}

0 commit comments

Comments
 (0)