Skip to content

Commit 50fabd4

Browse files
Matthew Wilcox (Oracle)Andreas Gruenbacher
authored andcommitted
gfs2: Convert gfs2_aspace_writepage() to use a folio
Convert the incoming struct page to a folio and use it throughout. Saves six calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent b844048 commit 50fabd4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

fs/gfs2/meta_io.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232

3333
static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wbc)
3434
{
35+
struct folio *folio = page_folio(page);
3536
struct buffer_head *bh, *head;
3637
int nr_underway = 0;
3738
blk_opf_t write_flags = REQ_META | REQ_PRIO | wbc_to_write_flags(wbc);
3839

39-
BUG_ON(!PageLocked(page));
40-
BUG_ON(!page_has_buffers(page));
40+
BUG_ON(!folio_test_locked(folio));
4141

42-
head = page_buffers(page);
42+
head = folio_buffers(folio);
4343
bh = head;
4444

4545
do {
@@ -55,7 +55,7 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb
5555
if (wbc->sync_mode != WB_SYNC_NONE) {
5656
lock_buffer(bh);
5757
} else if (!trylock_buffer(bh)) {
58-
redirty_page_for_writepage(wbc, page);
58+
folio_redirty_for_writepage(wbc, folio);
5959
continue;
6060
}
6161
if (test_clear_buffer_dirty(bh)) {
@@ -69,8 +69,8 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb
6969
* The page and its buffers are protected by PageWriteback(), so we can
7070
* drop the bh refcounts early.
7171
*/
72-
BUG_ON(PageWriteback(page));
73-
set_page_writeback(page);
72+
BUG_ON(folio_test_writeback(folio));
73+
folio_start_writeback(folio);
7474

7575
do {
7676
struct buffer_head *next = bh->b_this_page;
@@ -80,10 +80,10 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb
8080
}
8181
bh = next;
8282
} while (bh != head);
83-
unlock_page(page);
83+
folio_unlock(folio);
8484

8585
if (nr_underway == 0)
86-
end_page_writeback(page);
86+
folio_end_writeback(folio);
8787

8888
return 0;
8989
}

0 commit comments

Comments
 (0)