提交 c56a6eb0 编写于 作者: M Matthew Wilcox (Oracle)

jbd2: Convert jbd2_journal_try_to_free_buffers to take a folio

Also convert it to return a bool since it's called from release_folio().
Signed-off-by: NMatthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: NTheodore Ts'o <tytso@mit.edu>
Reviewed-by: NJeff Layton <jlayton@kernel.org>
上级 be6b969c
...@@ -3253,7 +3253,7 @@ static bool ext4_release_folio(struct folio *folio, gfp_t wait) ...@@ -3253,7 +3253,7 @@ static bool ext4_release_folio(struct folio *folio, gfp_t wait)
if (folio_test_checked(folio)) if (folio_test_checked(folio))
return false; return false;
if (journal) if (journal)
return jbd2_journal_try_to_free_buffers(journal, &folio->page); return jbd2_journal_try_to_free_buffers(journal, folio);
else else
return try_to_free_buffers(&folio->page); return try_to_free_buffers(&folio->page);
} }
......
...@@ -2143,17 +2143,17 @@ __journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh) ...@@ -2143,17 +2143,17 @@ __journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh)
* cannot happen because we never reallocate freed data as metadata * cannot happen because we never reallocate freed data as metadata
* while the data is part of a transaction. Yes? * 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 *head;
struct buffer_head *bh; 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; bh = head;
do { do {
struct journal_head *jh; struct journal_head *jh;
...@@ -2175,7 +2175,7 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal, struct page *page) ...@@ -2175,7 +2175,7 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal, struct page *page)
goto busy; goto busy;
} while ((bh = bh->b_this_page) != head); } while ((bh = bh->b_this_page) != head);
ret = try_to_free_buffers(page); ret = try_to_free_buffers(&folio->page);
busy: busy:
return ret; return ret;
} }
......
...@@ -1529,7 +1529,7 @@ extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); ...@@ -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 *); extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
int jbd2_journal_invalidate_folio(journal_t *, struct folio *, int jbd2_journal_invalidate_folio(journal_t *, struct folio *,
size_t offset, size_t length); 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_stop(handle_t *);
extern int jbd2_journal_flush(journal_t *journal, unsigned int flags); extern int jbd2_journal_flush(journal_t *journal, unsigned int flags);
extern void jbd2_journal_lock_updates (journal_t *); extern void jbd2_journal_lock_updates (journal_t *);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册