Skip to content

Commit

Permalink
mm: drop "wait" parameter from write_one_page()
Browse files Browse the repository at this point in the history
The callers all set it to 1.

Also, make it clear that this function will not set any sort of AS_*
error, and that the caller must do so if necessary.  No existing caller
uses this on normal files, so none of them need it.

Also, add __must_check here since, in general, the callers need to handle
an error here in some fashion.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Jeff Layton <[email protected]>
Reviewed-by: Ross Zwisler <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Reviewed-by: Matthew Wilcox <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
jtlayton committed Jul 5, 2017
1 parent c86daad commit 2b69c82
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion fs/exofs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static int exofs_commit_chunk(struct page *page, loff_t pos, unsigned len)
set_page_dirty(page);

if (IS_DIRSYNC(dir))
err = write_one_page(page, 1);
err = write_one_page(page);
else
unlock_page(page);

Expand Down
2 changes: 1 addition & 1 deletion fs/ext2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static int ext2_commit_chunk(struct page *page, loff_t pos, unsigned len)
}

if (IS_DIRSYNC(dir)) {
err = write_one_page(page, 1);
err = write_one_page(page);
if (!err)
err = sync_inode_metadata(dir, 1);
} else {
Expand Down
4 changes: 2 additions & 2 deletions fs/jfs/jfs_metapage.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ void force_metapage(struct metapage *mp)
get_page(page);
lock_page(page);
set_page_dirty(page);
write_one_page(page, 1);
write_one_page(page);
clear_bit(META_forcewrite, &mp->flag);
put_page(page);
}
Expand Down Expand Up @@ -756,7 +756,7 @@ void release_metapage(struct metapage * mp)
set_page_dirty(page);
if (test_bit(META_sync, &mp->flag)) {
clear_bit(META_sync, &mp->flag);
write_one_page(page, 1);
write_one_page(page);
lock_page(page); /* write_one_page unlocks the page */
}
} else if (mp->lsn) /* discard_metapage doesn't remove it */
Expand Down
2 changes: 1 addition & 1 deletion fs/minix/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static int dir_commit_chunk(struct page *page, loff_t pos, unsigned len)
mark_inode_dirty(dir);
}
if (IS_DIRSYNC(dir))
err = write_one_page(page, 1);
err = write_one_page(page);
else
unlock_page(page);
return err;
Expand Down
2 changes: 1 addition & 1 deletion fs/sysv/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static int dir_commit_chunk(struct page *page, loff_t pos, unsigned len)
mark_inode_dirty(dir);
}
if (IS_DIRSYNC(dir))
err = write_one_page(page, 1);
err = write_one_page(page);
else
unlock_page(page);
return err;
Expand Down
2 changes: 1 addition & 1 deletion fs/ufs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static int ufs_commit_chunk(struct page *page, loff_t pos, unsigned len)
mark_inode_dirty(dir);
}
if (IS_DIRSYNC(dir))
err = write_one_page(page, 1);
err = write_one_page(page);
else
unlock_page(page);
return err;
Expand Down
2 changes: 1 addition & 1 deletion include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -2199,7 +2199,7 @@ extern void filemap_map_pages(struct vm_fault *vmf,
extern int filemap_page_mkwrite(struct vm_fault *vmf);

/* mm/page-writeback.c */
int write_one_page(struct page *page, int wait);
int __must_check write_one_page(struct page *page);
void task_dirty_inc(struct task_struct *tsk);

/* readahead.c */
Expand Down
14 changes: 7 additions & 7 deletions mm/page-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -2366,15 +2366,16 @@ int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
}

/**
* write_one_page - write out a single page and optionally wait on I/O
* write_one_page - write out a single page and wait on I/O
* @page: the page to write
* @wait: if true, wait on writeout
*
* The page must be locked by the caller and will be unlocked upon return.
*
* write_one_page() returns a negative error code if I/O failed.
* write_one_page() returns a negative error code if I/O failed. Note that
* the address_space is not marked for error. The caller must do this if
* needed.
*/
int write_one_page(struct page *page, int wait)
int write_one_page(struct page *page)
{
struct address_space *mapping = page->mapping;
int ret = 0;
Expand All @@ -2385,13 +2386,12 @@ int write_one_page(struct page *page, int wait)

BUG_ON(!PageLocked(page));

if (wait)
wait_on_page_writeback(page);
wait_on_page_writeback(page);

if (clear_page_dirty_for_io(page)) {
get_page(page);
ret = mapping->a_ops->writepage(page, &wbc);
if (ret == 0 && wait) {
if (ret == 0) {
wait_on_page_writeback(page);
if (PageError(page))
ret = -EIO;
Expand Down

0 comments on commit 2b69c82

Please sign in to comment.