The patch titled Subject: ocfs2: convert ocfs2_inode_lock_with_page() to ocfs2_inode_lock_with_folio() has been added to the -mm mm-nonmm-unstable branch. Its filename is ocfs2-convert-ocfs2_inode_lock_with_page-to-ocfs2_inode_lock_with_folio.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/ocfs2-convert-ocfs2_inode_lock_with_page-to-ocfs2_inode_lock_with_folio.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Mark Tinguely <mark.tinguely@xxxxxxxxxx> Subject: ocfs2: convert ocfs2_inode_lock_with_page() to ocfs2_inode_lock_with_folio() Date: Thu, 5 Dec 2024 17:16:36 +0000 Saves a hidden call to compound_head(). Link: https://lkml.kernel.org/r/20241205171653.3179945-9-willy@xxxxxxxxxxxxx Signed-off-by: Mark Tinguely <mark.tinguely@xxxxxxxxxx> Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Reviewed-by: Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx> Cc: Changwei Ge <gechangwei@xxxxxxx> Cc: Joel Becker <jlbec@xxxxxxxxxxxx> Cc: Jun Piao <piaojun@xxxxxxxxxx> Cc: Junxiao Bi <junxiao.bi@xxxxxxxxxx> Cc: Mark Fasheh <mark@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/ocfs2/aops.c | 2 +- fs/ocfs2/dlmglue.c | 18 ++++++++---------- fs/ocfs2/dlmglue.h | 6 ++---- 3 files changed, 11 insertions(+), 15 deletions(-) --- a/fs/ocfs2/aops.c~ocfs2-convert-ocfs2_inode_lock_with_page-to-ocfs2_inode_lock_with_folio +++ a/fs/ocfs2/aops.c @@ -283,7 +283,7 @@ static int ocfs2_read_folio(struct file trace_ocfs2_readpage((unsigned long long)oi->ip_blkno, folio->index); - ret = ocfs2_inode_lock_with_page(inode, NULL, 0, &folio->page); + ret = ocfs2_inode_lock_with_folio(inode, NULL, 0, folio); if (ret != 0) { if (ret == AOP_TRUNCATED_PAGE) unlock = 0; --- a/fs/ocfs2/dlmglue.c~ocfs2-convert-ocfs2_inode_lock_with_page-to-ocfs2_inode_lock_with_folio +++ a/fs/ocfs2/dlmglue.c @@ -2529,30 +2529,28 @@ bail: /* * This is working around a lock inversion between tasks acquiring DLM - * locks while holding a page lock and the downconvert thread which - * blocks dlm lock acquiry while acquiring page locks. + * locks while holding a folio lock and the downconvert thread which + * blocks dlm lock acquiry while acquiring folio locks. * - * ** These _with_page variants are only intended to be called from aop - * methods that hold page locks and return a very specific *positive* error + * ** These _with_folio variants are only intended to be called from aop + * methods that hold folio locks and return a very specific *positive* error * code that aop methods pass up to the VFS -- test for errors with != 0. ** * * The DLM is called such that it returns -EAGAIN if it would have * blocked waiting for the downconvert thread. In that case we unlock - * our page so the downconvert thread can make progress. Once we've + * our folio so the downconvert thread can make progress. Once we've * done this we have to return AOP_TRUNCATED_PAGE so the aop method * that called us can bubble that back up into the VFS who will then * immediately retry the aop call. */ -int ocfs2_inode_lock_with_page(struct inode *inode, - struct buffer_head **ret_bh, - int ex, - struct page *page) +int ocfs2_inode_lock_with_folio(struct inode *inode, + struct buffer_head **ret_bh, int ex, struct folio *folio) { int ret; ret = ocfs2_inode_lock_full(inode, ret_bh, ex, OCFS2_LOCK_NONBLOCK); if (ret == -EAGAIN) { - unlock_page(page); + folio_unlock(folio); /* * If we can't get inode lock immediately, we should not return * directly here, since this will lead to a softlockup problem. --- a/fs/ocfs2/dlmglue.h~ocfs2-convert-ocfs2_inode_lock_with_page-to-ocfs2_inode_lock_with_folio +++ a/fs/ocfs2/dlmglue.h @@ -137,10 +137,8 @@ int ocfs2_inode_lock_full_nested(struct int ex, int arg_flags, int subclass); -int ocfs2_inode_lock_with_page(struct inode *inode, - struct buffer_head **ret_bh, - int ex, - struct page *page); +int ocfs2_inode_lock_with_folio(struct inode *inode, + struct buffer_head **ret_bh, int ex, struct folio *folio); /* Variants without special locking class or flags */ #define ocfs2_inode_lock_full(i, r, e, f)\ ocfs2_inode_lock_full_nested(i, r, e, f, OI_LS_NORMAL) _ Patches currently in -mm which might be from mark.tinguely@xxxxxxxxxx are ocfs2-convert-w_target_page-to-w_target_folio.patch ocfs2-use-a-folio-in-ocfs2_zero_new_buffers.patch ocfs2-use-a-folio-in-ocfs2_write_begin_inline.patch ocfs2-convert-ocfs2_readpage_inline-to-take-a-folio.patch ocfs2-convert-ocfs2_inode_lock_with_page-to-ocfs2_inode_lock_with_folio.patch ocfs2-convert-w_pages-to-w_folios.patch ocfs2-convert-ocfs2_write_failure-to-use-a-folio.patch ocfs2-use-a-folio-in-ocfs2_write_end_nolock.patch ocfs2-use-a-folio-in-ocfs2_prepare_page_for_write.patch ocfs2-use-a-folio-in-ocfs2_map_and_dirty_page.patch ocfs2-convert-ocfs2_map_page_blocks-to-ocfs2_map_folio_blocks.patch ocfs2-convert-ocfs2_clear_page_regions-to-ocfs2_clear_folio_regions.patch ocfs2-use-an-array-of-folios-instead-of-an-array-of-pages.patch ocfs2-convert-ocfs2_duplicate_clusters_by_page-to-use-a-folio.patch ocfs2-convert-ocfs2_map_and_dirty_page-to-ocfs2_map_and_dirty_folio.patch ocfs2-support-large-folios-in-ocfs2_zero_cluster_folios.patch ocfs2-support-large-folios-in-ocfs2_write_zero_page.patch