Skip to content

Commit 901849e

Browse files
Matthew Wilcox (Oracle)Andreas Gruenbacher
authored andcommitted
gfs2: Add gfs2_aspace_writepages()
This saves one indirect function call per folio and gets us closer to removing aops->writepage. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 6cb9df8 commit 901849e

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

fs/gfs2/meta_io.c

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
#include "util.h"
3131
#include "trace_gfs2.h"
3232

33-
static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wbc)
33+
static void gfs2_aspace_write_folio(struct folio *folio,
34+
struct writeback_control *wbc)
3435
{
35-
struct folio *folio = page_folio(page);
3636
struct buffer_head *bh, *head;
3737
int nr_underway = 0;
3838
blk_opf_t write_flags = REQ_META | REQ_PRIO | wbc_to_write_flags(wbc);
@@ -66,8 +66,8 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb
6666
} while ((bh = bh->b_this_page) != head);
6767

6868
/*
69-
* The page and its buffers are protected by PageWriteback(), so we can
70-
* drop the bh refcounts early.
69+
* The folio and its buffers are protected from truncation by
70+
* the writeback flag, so we can drop the bh refcounts early.
7171
*/
7272
BUG_ON(folio_test_writeback(folio));
7373
folio_start_writeback(folio);
@@ -84,21 +84,39 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb
8484

8585
if (nr_underway == 0)
8686
folio_end_writeback(folio);
87+
}
88+
89+
static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wbc)
90+
{
91+
gfs2_aspace_write_folio(page_folio(page), wbc);
8792

8893
return 0;
8994
}
9095

96+
static int gfs2_aspace_writepages(struct address_space *mapping,
97+
struct writeback_control *wbc)
98+
{
99+
struct folio *folio = NULL;
100+
int error;
101+
102+
while ((folio = writeback_iter(mapping, wbc, folio, &error)))
103+
gfs2_aspace_write_folio(folio, wbc);
104+
105+
return error;
106+
}
107+
91108
const struct address_space_operations gfs2_meta_aops = {
92109
.dirty_folio = block_dirty_folio,
93110
.invalidate_folio = block_invalidate_folio,
94-
.writepage = gfs2_aspace_writepage,
111+
.writepages = gfs2_aspace_writepages,
95112
.release_folio = gfs2_release_folio,
96113
};
97114

98115
const struct address_space_operations gfs2_rgrp_aops = {
99116
.dirty_folio = block_dirty_folio,
100117
.invalidate_folio = block_invalidate_folio,
101118
.writepage = gfs2_aspace_writepage,
119+
.writepages = gfs2_aspace_writepages,
102120
.release_folio = gfs2_release_folio,
103121
};
104122

0 commit comments

Comments
 (0)