Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

filemap: Add a version of folio_end_writeback that ignores dropbehind

Filesystems such as NFS may need to defer dropbehind until after their
2-stage writes are done. This adds a helper
folio_end_writeback_no_dropbehind() that allows them to release the
writeback flag without immediately dropping the folio.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>

authored by

Trond Myklebust and committed by
Anna Schumaker
010054a5 24bbd533

+24 -6
+1
include/linux/pagemap.h
··· 1221 1221 int folio_wait_writeback_killable(struct folio *folio); 1222 1222 void end_page_writeback(struct page *page); 1223 1223 void folio_end_writeback(struct folio *folio); 1224 + void folio_end_writeback_no_dropbehind(struct folio *folio); 1224 1225 void folio_end_dropbehind(struct folio *folio); 1225 1226 void folio_wait_stable(struct folio *folio); 1226 1227 void __folio_mark_dirty(struct folio *folio, struct address_space *, int warn);
+23 -6
mm/filemap.c
··· 1628 1628 EXPORT_SYMBOL_GPL(folio_end_dropbehind); 1629 1629 1630 1630 /** 1631 - * folio_end_writeback - End writeback against a folio. 1631 + * folio_end_writeback_no_dropbehind - End writeback against a folio. 1632 1632 * @folio: The folio. 1633 1633 * 1634 1634 * The folio must actually be under writeback. 1635 + * This call is intended for filesystems that need to defer dropbehind. 1635 1636 * 1636 1637 * Context: May be called from process or interrupt context. 1637 1638 */ 1638 - void folio_end_writeback(struct folio *folio) 1639 + void folio_end_writeback_no_dropbehind(struct folio *folio) 1639 1640 { 1640 1641 VM_BUG_ON_FOLIO(!folio_test_writeback(folio), folio); 1641 1642 ··· 1652 1651 folio_rotate_reclaimable(folio); 1653 1652 } 1654 1653 1654 + if (__folio_end_writeback(folio)) 1655 + folio_wake_bit(folio, PG_writeback); 1656 + 1657 + acct_reclaim_writeback(folio); 1658 + } 1659 + EXPORT_SYMBOL_GPL(folio_end_writeback_no_dropbehind); 1660 + 1661 + /** 1662 + * folio_end_writeback - End writeback against a folio. 1663 + * @folio: The folio. 1664 + * 1665 + * The folio must actually be under writeback. 1666 + * 1667 + * Context: May be called from process or interrupt context. 1668 + */ 1669 + void folio_end_writeback(struct folio *folio) 1670 + { 1671 + VM_BUG_ON_FOLIO(!folio_test_writeback(folio), folio); 1672 + 1655 1673 /* 1656 1674 * Writeback does not hold a folio reference of its own, relying 1657 1675 * on truncation to wait for the clearing of PG_writeback. ··· 1678 1658 * reused before the folio_wake_bit(). 1679 1659 */ 1680 1660 folio_get(folio); 1681 - if (__folio_end_writeback(folio)) 1682 - folio_wake_bit(folio, PG_writeback); 1683 - 1661 + folio_end_writeback_no_dropbehind(folio); 1684 1662 folio_end_dropbehind(folio); 1685 - acct_reclaim_writeback(folio); 1686 1663 folio_put(folio); 1687 1664 } 1688 1665 EXPORT_SYMBOL(folio_end_writeback);