diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2021-02-24 21:02:38 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-02-24 22:38:28 +0100 |
commit | aa1ec2f69780c5b9590143162101b6dc3dc1de5f (patch) | |
tree | c0f27dadbbe76b6591efb89ece310639663fb8fe /mm/filemap.c | |
parent | mm/filemap: restructure filemap_get_pages (diff) | |
download | linux-aa1ec2f69780c5b9590143162101b6dc3dc1de5f.tar.xz linux-aa1ec2f69780c5b9590143162101b6dc3dc1de5f.zip |
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.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Kent Overstreet <kent.overstreet@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 3311b2af9061..1358cb061fd6 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2214,23 +2214,16 @@ static int filemap_read_page(struct file *file, struct address_space *mapping, error = mapping->a_ops->readpage(file, page); if (error) return error; - if (PageUptodate(page)) - return 0; - error = lock_page_killable(page); + error = wait_on_page_locked_killable(page); if (error) return error; - if (!PageUptodate(page)) { - if (page->mapping == NULL) { - /* page truncated */ - error = AOP_TRUNCATED_PAGE; - } else { - shrink_readahead_size_eio(&file->f_ra); - error = -EIO; - } - } - unlock_page(page); - return error; + if (PageUptodate(page)) + return 0; + if (!page->mapping) /* page truncated */ + return AOP_TRUNCATED_PAGE; + shrink_readahead_size_eio(&file->f_ra); + return -EIO; } static bool filemap_range_uptodate(struct address_space *mapping, |