summaryrefslogtreecommitdiff
path: root/mm/shmem.c
diff options
context:
space:
mode:
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>2005-09-03 15:54:55 -0700
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 00:05:45 -0700
commitd44ed4f86892e350f4b16a3489b7e7c1a9bb7ead (patch)
tree19614a214c186c62ee6c5d3879392f6184f93e5b /mm/shmem.c
parent0abf40c1ac3f25d264c019e1cfe155d590defb87 (diff)
downloadlinux-3.10-d44ed4f86892e350f4b16a3489b7e7c1a9bb7ead.tar.gz
linux-3.10-d44ed4f86892e350f4b16a3489b7e7c1a9bb7ead.tar.bz2
linux-3.10-d44ed4f86892e350f4b16a3489b7e7c1a9bb7ead.zip
[PATCH] shmem_populate: avoid an useless check, and some comments
Either shmem_getpage returns a failure, or it found a page, or it was told it couldn't do any I/O. So it's useless to check nonblock in the else branch. We could add a BUG() there but I preferred to comment the offending function. This was taken out from one Ingo Molnar's old patch I'm resurrecting. Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Cc: Ingo Molnar <mingo@elte.hu> Cc: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/shmem.c')
-rw-r--r--mm/shmem.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index 5a81b1ee4f7..08a3bc2fba6 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1195,6 +1195,7 @@ static int shmem_populate(struct vm_area_struct *vma,
err = shmem_getpage(inode, pgoff, &page, sgp, NULL);
if (err)
return err;
+ /* Page may still be null, but only if nonblock was set. */
if (page) {
mark_page_accessed(page);
err = install_page(mm, vma, addr, page, prot);
@@ -1202,7 +1203,10 @@ static int shmem_populate(struct vm_area_struct *vma,
page_cache_release(page);
return err;
}
- } else if (nonblock) {
+ } else {
+ /* No page was found just because we can't read it in
+ * now (being here implies nonblock != 0), but the page
+ * may exist, so set the PTE to fault it in later. */
err = install_file_pte(mm, vma, addr, pgoff, prot);
if (err)
return err;