aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>2005-09-03 18:54:55 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 03:05:45 -0400
commitd44ed4f86892e350f4b16a3489b7e7c1a9bb7ead (patch)
tree19614a214c186c62ee6c5d3879392f6184f93e5b /mm
parent0abf40c1ac3f25d264c019e1cfe155d590defb87 (diff)
[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')
-rw-r--r--mm/filemap.c7
-rw-r--r--mm/shmem.c6
2 files changed, 12 insertions, 1 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index edc54436fa94..88611928e71f 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1504,8 +1504,12 @@ repeat:
1504 return -EINVAL; 1504 return -EINVAL;
1505 1505
1506 page = filemap_getpage(file, pgoff, nonblock); 1506 page = filemap_getpage(file, pgoff, nonblock);
1507
1508 /* XXX: This is wrong, a filesystem I/O error may have happened. Fix that as
1509 * done in shmem_populate calling shmem_getpage */
1507 if (!page && !nonblock) 1510 if (!page && !nonblock)
1508 return -ENOMEM; 1511 return -ENOMEM;
1512
1509 if (page) { 1513 if (page) {
1510 err = install_page(mm, vma, addr, page, prot); 1514 err = install_page(mm, vma, addr, page, prot);
1511 if (err) { 1515 if (err) {
@@ -1513,6 +1517,9 @@ repeat:
1513 return err; 1517 return err;
1514 } 1518 }
1515 } else { 1519 } else {
1520 /* No page was found just because we can't read it in now (being
1521 * here implies nonblock != 0), but the page may exist, so set
1522 * the PTE to fault it in later. */
1516 err = install_file_pte(mm, vma, addr, pgoff, prot); 1523 err = install_file_pte(mm, vma, addr, pgoff, prot);
1517 if (err) 1524 if (err)
1518 return err; 1525 return err;
diff --git a/mm/shmem.c b/mm/shmem.c
index 5a81b1ee4f7a..08a3bc2fba61 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1195,6 +1195,7 @@ static int shmem_populate(struct vm_area_struct *vma,
1195 err = shmem_getpage(inode, pgoff, &page, sgp, NULL); 1195 err = shmem_getpage(inode, pgoff, &page, sgp, NULL);
1196 if (err) 1196 if (err)
1197 return err; 1197 return err;
1198 /* Page may still be null, but only if nonblock was set. */
1198 if (page) { 1199 if (page) {
1199 mark_page_accessed(page); 1200 mark_page_accessed(page);
1200 err = install_page(mm, vma, addr, page, prot); 1201 err = install_page(mm, vma, addr, page, prot);
@@ -1202,7 +1203,10 @@ static int shmem_populate(struct vm_area_struct *vma,
1202 page_cache_release(page); 1203 page_cache_release(page);
1203 return err; 1204 return err;
1204 } 1205 }
1205 } else if (nonblock) { 1206 } else {
1207 /* No page was found just because we can't read it in
1208 * now (being here implies nonblock != 0), but the page
1209 * may exist, so set the PTE to fault it in later. */
1206 err = install_file_pte(mm, vma, addr, pgoff, prot); 1210 err = install_file_pte(mm, vma, addr, pgoff, prot);
1207 if (err) 1211 if (err)
1208 return err; 1212 return err;