jbd2: Convert jbd2_journal_try_to_free_buffers to take a folio
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 1 May 2022 04:46:03 +0000 (00:46 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 10 May 2022 03:12:33 +0000 (23:12 -0400)
Also convert it to return a bool since it's called from release_folio().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
fs/ext4/inode.c
fs/jbd2/transaction.c
include/linux/jbd2.h

index 52c46ac5bc8a4d7dbee28afe8897c82457720ec2..943937cb5302783d082e164d3c3c82991373b947 100644 (file)
@@ -3253,7 +3253,7 @@ static bool ext4_release_folio(struct folio *folio, gfp_t wait)
        if (folio_test_checked(folio))
                return false;
        if (journal)
-               return jbd2_journal_try_to_free_buffers(journal, &folio->page);
+               return jbd2_journal_try_to_free_buffers(journal, folio);
        else
                return try_to_free_buffers(&folio->page);
 }
index fcb9175016a59ed19fc28a1636f59216b4da0484..ee33d277d51eabe8befa21d911176f2ec5643eae 100644 (file)
@@ -2143,17 +2143,17 @@ out:
  * cannot happen because we never reallocate freed data as metadata
  * while the data is part of a transaction.  Yes?
  *
- * Return 0 on failure, 1 on success
+ * Return false on failure, true on success
  */
-int jbd2_journal_try_to_free_buffers(journal_t *journal, struct page *page)
+bool jbd2_journal_try_to_free_buffers(journal_t *journal, struct folio *folio)
 {
        struct buffer_head *head;
        struct buffer_head *bh;
-       int ret = 0;
+       bool ret = false;
 
-       J_ASSERT(PageLocked(page));
+       J_ASSERT(folio_test_locked(folio));
 
-       head = page_buffers(page);
+       head = folio_buffers(folio);
        bh = head;
        do {
                struct journal_head *jh;
@@ -2175,7 +2175,7 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal, struct page *page)
                        goto busy;
        } while ((bh = bh->b_this_page) != head);
 
-       ret = try_to_free_buffers(page);
+       ret = try_to_free_buffers(&folio->page);
 busy:
        return ret;
 }
index de9536680b2b5d6c145b89ae50b136ea486937e6..e79d6e0b14e8e8be8e2286908f73d43ca4d52748 100644 (file)
@@ -1529,7 +1529,7 @@ extern int         jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
 extern int      jbd2_journal_forget (handle_t *, struct buffer_head *);
 int jbd2_journal_invalidate_folio(journal_t *, struct folio *,
                                        size_t offset, size_t length);
-extern int      jbd2_journal_try_to_free_buffers(journal_t *journal, struct page *page);
+bool jbd2_journal_try_to_free_buffers(journal_t *journal, struct folio *folio);
 extern int      jbd2_journal_stop(handle_t *);
 extern int      jbd2_journal_flush(journal_t *journal, unsigned int flags);
 extern void     jbd2_journal_lock_updates (journal_t *);