All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/filemap: Drop check for truncated page after I/O
@ 2021-03-03 22:25 Matthew Wilcox (Oracle)
  2021-03-04 22:50 ` William Kucharski
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Wilcox (Oracle) @ 2021-03-03 22:25 UTC (permalink / raw)
  To: Andrew Morton, linux-mm, linux-kernel, Miklos Szeredi
  Cc: Matthew Wilcox (Oracle)

If the I/O completed successfully, the page will remain Uptodate,
even if it is subsequently truncated.  If the I/O completed with an error,
this check would cause us to retry the I/O if the page were truncated
before we woke up.  There is no need to retry the I/O; the I/O to fill
the page failed, so we can legitimately just return -EIO.

This code was originally added by commit 56f0d5fe6851 ("[PATCH]
readpage-vs-invalidate fix") in 2005 (this commit ID is from the
linux-fullhistory tree; it is also commit ba1f08f14b52 in tglx-history).

At the time, truncate_complete_page() called ClearPageUptodate(), and
so this was fixing a real bug.  In 2008, commit 84209e02de48
("mm: dont clear PG_uptodate on truncate/invalidate") removed the
call to ClearPageUptodate, and this check has been unnecessary ever
since.

It doesn't do any real harm, but there's no need to keep it.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/filemap.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 8d3e0daed7c9..3d1635d3be3e 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2238,8 +2238,6 @@ static int filemap_read_page(struct file *file, struct address_space *mapping,
 		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;
 }
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-04 22:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03 22:25 [PATCH] mm/filemap: Drop check for truncated page after I/O Matthew Wilcox (Oracle)
2021-03-04 22:50 ` William Kucharski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.