提交 aa1ec2f6 编写于 作者: M Matthew Wilcox (Oracle) 提交者: Linus Torvalds

mm/filemap: don't relock the page after calling readpage

We don't need to get the page lock again; we just need to wait for the I/O
to finish, so use wait_on_page_locked_killable() like the other callers of
->readpage.

Link: https://lkml.kernel.org/r/20210122160140.223228-17-willy@infradead.orgSigned-off-by: NMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: NKent Overstreet <kent.overstreet@gmail.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 2642fca6
...@@ -2214,23 +2214,16 @@ static int filemap_read_page(struct file *file, struct address_space *mapping, ...@@ -2214,23 +2214,16 @@ static int filemap_read_page(struct file *file, struct address_space *mapping,
error = mapping->a_ops->readpage(file, page); error = mapping->a_ops->readpage(file, page);
if (error) if (error)
return error; return error;
if (PageUptodate(page))
return 0;
error = lock_page_killable(page); error = wait_on_page_locked_killable(page);
if (error) if (error)
return error; return error;
if (!PageUptodate(page)) { if (PageUptodate(page))
if (page->mapping == NULL) { return 0;
/* page truncated */ if (!page->mapping) /* page truncated */
error = AOP_TRUNCATED_PAGE; return AOP_TRUNCATED_PAGE;
} else {
shrink_readahead_size_eio(&file->f_ra); shrink_readahead_size_eio(&file->f_ra);
error = -EIO; return -EIO;
}
}
unlock_page(page);
return error;
} }
static bool filemap_range_uptodate(struct address_space *mapping, static bool filemap_range_uptodate(struct address_space *mapping,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册