jbd2: Convert release_buffer_page() to use a folio

Saves a few calls to compound_head().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
This commit is contained in:
Matthew Wilcox (Oracle) 2022-05-01 00:52:35 -04:00
parent c56a6eb03d
commit 731222557a

View File

@ -62,6 +62,7 @@ static void journal_end_buffer_io_sync(struct buffer_head *bh, int uptodate)
*/
static void release_buffer_page(struct buffer_head *bh)
{
struct folio *folio;
struct page *page;
if (buffer_dirty(bh))
@ -71,18 +72,19 @@ static void release_buffer_page(struct buffer_head *bh)
page = bh->b_page;
if (!page)
goto nope;
if (page->mapping)
folio = page_folio(page);
if (folio->mapping)
goto nope;
/* OK, it's a truncated page */
if (!trylock_page(page))
if (!folio_trylock(folio))
goto nope;
get_page(page);
folio_get(folio);
__brelse(bh);
try_to_free_buffers(page);
unlock_page(page);
put_page(page);
try_to_free_buffers(&folio->page);
folio_unlock(folio);
folio_put(folio);
return;
nope: