Skip to content

Commit 5241060

Browse files
Trond Myklebustamschuma-ntap
authored andcommitted
NFS: Convert the function nfs_wb_page() to use folios
Convert to use the folio functions, but pass the struct page to nfs_writepage_locked() for now. Signed-off-by: Trond Myklebust <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent ab75bff commit 5241060

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

fs/nfs/write.c

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,13 +2069,18 @@ int nfs_wb_folio_cancel(struct inode *inode, struct folio *folio)
20692069
return ret;
20702070
}
20712071

2072-
/*
2073-
* Write back all requests on one page - we do this before reading it.
2072+
/**
2073+
* nfs_wb_folio - Write back all requests on one page
2074+
* @inode: pointer to page
2075+
* @folio: pointer to folio
2076+
*
2077+
* Assumes that the folio has been locked by the caller, and will
2078+
* not unlock it.
20742079
*/
2075-
int nfs_wb_page(struct inode *inode, struct page *page)
2080+
int nfs_wb_folio(struct inode *inode, struct folio *folio)
20762081
{
2077-
loff_t range_start = page_file_offset(page);
2078-
loff_t range_end = range_start + (loff_t)(PAGE_SIZE - 1);
2082+
loff_t range_start = folio_file_pos(folio);
2083+
loff_t range_end = range_start + (loff_t)folio_size(folio) - 1;
20792084
struct writeback_control wbc = {
20802085
.sync_mode = WB_SYNC_ALL,
20812086
.nr_to_write = 0,
@@ -2087,15 +2092,15 @@ int nfs_wb_page(struct inode *inode, struct page *page)
20872092
trace_nfs_writeback_page_enter(inode);
20882093

20892094
for (;;) {
2090-
wait_on_page_writeback(page);
2091-
if (clear_page_dirty_for_io(page)) {
2092-
ret = nfs_writepage_locked(page, &wbc);
2095+
folio_wait_writeback(folio);
2096+
if (folio_clear_dirty_for_io(folio)) {
2097+
ret = nfs_writepage_locked(&folio->page, &wbc);
20932098
if (ret < 0)
20942099
goto out_error;
20952100
continue;
20962101
}
20972102
ret = 0;
2098-
if (!PagePrivate(page))
2103+
if (!folio_test_private(folio))
20992104
break;
21002105
ret = nfs_commit_inode(inode, FLUSH_SYNC);
21012106
if (ret < 0)
@@ -2106,17 +2111,9 @@ int nfs_wb_page(struct inode *inode, struct page *page)
21062111
return ret;
21072112
}
21082113

2109-
/**
2110-
* nfs_wb_folio - Write back all requests on one page
2111-
* @inode: pointer to page
2112-
* @folio: pointer to folio
2113-
*
2114-
* Assumes that the folio has been locked by the caller, and will
2115-
* not unlock it.
2116-
*/
2117-
int nfs_wb_folio(struct inode *inode, struct folio *folio)
2114+
int nfs_wb_page(struct inode *inode, struct page *page)
21182115
{
2119-
return nfs_wb_page(inode, &folio->page);
2116+
return nfs_wb_folio(inode, page_folio(page));
21202117
}
21212118

21222119
#ifdef CONFIG_MIGRATION

0 commit comments

Comments
 (0)