Skip to content

Commit c56a6eb

Browse files
author
Matthew Wilcox (Oracle)
committed
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: Matthew Wilcox (Oracle) <willy@infradead.org> Acked-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Jeff Layton <jlayton@kernel.org>
1 parent be6b969 commit c56a6eb

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

fs/ext4/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3253,7 +3253,7 @@ static bool ext4_release_folio(struct folio *folio, gfp_t wait)
32533253
if (folio_test_checked(folio))
32543254
return false;
32553255
if (journal)
3256-
return jbd2_journal_try_to_free_buffers(journal, &folio->page);
3256+
return jbd2_journal_try_to_free_buffers(journal, folio);
32573257
else
32583258
return try_to_free_buffers(&folio->page);
32593259
}

fs/jbd2/transaction.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,17 +2143,17 @@ __journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh)
21432143
* cannot happen because we never reallocate freed data as metadata
21442144
* while the data is part of a transaction. Yes?
21452145
*
2146-
* Return 0 on failure, 1 on success
2146+
* Return false on failure, true on success
21472147
*/
2148-
int jbd2_journal_try_to_free_buffers(journal_t *journal, struct page *page)
2148+
bool jbd2_journal_try_to_free_buffers(journal_t *journal, struct folio *folio)
21492149
{
21502150
struct buffer_head *head;
21512151
struct buffer_head *bh;
2152-
int ret = 0;
2152+
bool ret = false;
21532153

2154-
J_ASSERT(PageLocked(page));
2154+
J_ASSERT(folio_test_locked(folio));
21552155

2156-
head = page_buffers(page);
2156+
head = folio_buffers(folio);
21572157
bh = head;
21582158
do {
21592159
struct journal_head *jh;
@@ -2175,7 +2175,7 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal, struct page *page)
21752175
goto busy;
21762176
} while ((bh = bh->b_this_page) != head);
21772177

2178-
ret = try_to_free_buffers(page);
2178+
ret = try_to_free_buffers(&folio->page);
21792179
busy:
21802180
return ret;
21812181
}

include/linux/jbd2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,7 @@ extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
15291529
extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
15301530
int jbd2_journal_invalidate_folio(journal_t *, struct folio *,
15311531
size_t offset, size_t length);
1532-
extern int jbd2_journal_try_to_free_buffers(journal_t *journal, struct page *page);
1532+
bool jbd2_journal_try_to_free_buffers(journal_t *journal, struct folio *folio);
15331533
extern int jbd2_journal_stop(handle_t *);
15341534
extern int jbd2_journal_flush(journal_t *journal, unsigned int flags);
15351535
extern void jbd2_journal_lock_updates (journal_t *);

0 commit comments

Comments
 (0)