Commit d0cfcaee authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

gfs2: pass a folio to __gfs2_jdata_write_folio()

Remove a couple of folio->page conversions in the callers, and two calls
to compound_head() in the function itself.  Rename it from
__gfs2_jdata_writepage() to __gfs2_jdata_write_folio().

Link: https://lkml.kernel.org/r/20230612210141.730128-3-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Tested-by: default avatarBob Peterson <rpeterso@redhat.com>
Reviewed-by: default avatarBob Peterson <rpeterso@redhat.com>
Reviewed-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent c0ba597d
......@@ -113,30 +113,31 @@ static int gfs2_write_jdata_page(struct page *page,
}
/**
* __gfs2_jdata_writepage - The core of jdata writepage
* @page: The page to write
* __gfs2_jdata_write_folio - The core of jdata writepage
* @folio: The folio to write
* @wbc: The writeback control
*
* This is shared between writepage and writepages and implements the
* core of the writepage operation. If a transaction is required then
* PageChecked will have been set and the transaction will have
* the checked flag will have been set and the transaction will have
* already been started before this is called.
*/
static int __gfs2_jdata_writepage(struct page *page, struct writeback_control *wbc)
static int __gfs2_jdata_write_folio(struct folio *folio,
struct writeback_control *wbc)
{
struct inode *inode = page->mapping->host;
struct inode *inode = folio->mapping->host;
struct gfs2_inode *ip = GFS2_I(inode);
if (PageChecked(page)) {
ClearPageChecked(page);
if (!page_has_buffers(page)) {
create_empty_buffers(page, inode->i_sb->s_blocksize,
BIT(BH_Dirty)|BIT(BH_Uptodate));
if (folio_test_checked(folio)) {
folio_clear_checked(folio);
if (!folio_buffers(folio)) {
folio_create_empty_buffers(folio,
inode->i_sb->s_blocksize,
BIT(BH_Dirty)|BIT(BH_Uptodate));
}
gfs2_trans_add_databufs(ip, page_folio(page), 0, PAGE_SIZE);
gfs2_trans_add_databufs(ip, folio, 0, folio_size(folio));
}
return gfs2_write_jdata_page(page, wbc);
return gfs2_write_jdata_page(&folio->page, wbc);
}
/**
......@@ -159,7 +160,7 @@ static int gfs2_jdata_writepage(struct page *page, struct writeback_control *wbc
goto out;
if (folio_test_checked(folio) || current->journal_info)
goto out_ignore;
return __gfs2_jdata_writepage(&folio->page, wbc);
return __gfs2_jdata_write_folio(folio, wbc);
out_ignore:
folio_redirty_for_writepage(wbc, folio);
......@@ -256,7 +257,7 @@ static int gfs2_write_jdata_batch(struct address_space *mapping,
trace_wbc_writepage(wbc, inode_to_bdi(inode));
ret = __gfs2_jdata_writepage(&folio->page, wbc);
ret = __gfs2_jdata_write_folio(folio, wbc);
if (unlikely(ret)) {
if (ret == AOP_WRITEPAGE_ACTIVATE) {
folio_unlock(folio);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment