ocfs2: convert ocfs2_inode_lock_with_page() to ocfs2_inode_lock_with_folio()
authorMark Tinguely <mark.tinguely@oracle.com>
Thu, 5 Dec 2024 17:16:36 +0000 (17:16 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 13 Jan 2025 04:21:10 +0000 (20:21 -0800)
Saves a hidden call to compound_head().

Link: https://lkml.kernel.org/r/20241205171653.3179945-9-willy@infradead.org
Signed-off-by: Mark Tinguely <mark.tinguely@oracle.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Jun Piao <piaojun@huawei.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Mark Fasheh <mark@fasheh.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/aops.c
fs/ocfs2/dlmglue.c
fs/ocfs2/dlmglue.h

index c0a6b82a6a68a22753290391147bcb6c2f262bcf..87127a7f2f7837c5f09af9cc11d5f556bd7989c3 100644 (file)
@@ -283,7 +283,7 @@ static int ocfs2_read_folio(struct file *file, struct folio *folio)
 
        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;
index 8f08e89be37da08f3bce391a8522c03b3a14a156..c9b62a6d867355f1850fa7ac66280f5faaf1510d 100644 (file)
@@ -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.
index e5da5809ed95bac2d58ff2fd81bc448eb6a552fc..a3ebd7303ea20bae90a06fce2e391c735bf5b50c 100644 (file)
@@ -137,10 +137,8 @@ int ocfs2_inode_lock_full_nested(struct inode *inode,
                         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)