The compiler, at least for ix86, validly warns that the comparison
"next <= (loff_t)-1" is always true (and it's always true also for
x86-64 and probably all other arches - as long as pgoff_t isn't wider
than loff_t). The intention appears to be to avoid wrapping of "next",
so rather than eliminating the pointless comparison, fix the loop to
indeed get exited when "next" would otherwise wrap.

Signed-off-by: Jan Beulich <jbeul...@novell.com>
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: Suresh Jayaraman <sjayara...@suse.de>
Cc: sta...@kernel.org 

---
 fs/fscache/page.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- 3.0-rc7/fs/fscache/page.c
+++ 3.0-rc7-fscache-uncache-all/fs/fscache/page.c
@@ -976,15 +976,15 @@ void __fscache_uncache_all_inode_pages(s
 
        pagevec_init(&pvec, 0);
        next = 0;
-       while (next <= (loff_t)-1 &&
-              pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)
-              ) {
+       do {
+               if (!pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE))
+                       break;
                for (i = 0; i < pagevec_count(&pvec); i++) {
                        struct page *page = pvec.pages[i];
                        pgoff_t page_index = page->index;
 
-                       ASSERTCMP(page_index, >=, next);
-                       next = page_index + 1;
+                       ASSERTCMP(page_index, >, next);
+                       next = page_index;
 
                        if (PageFsCache(page)) {
                                __fscache_wait_on_page_write(cookie, page);
@@ -993,7 +993,7 @@ void __fscache_uncache_all_inode_pages(s
                }
                pagevec_release(&pvec);
                cond_resched();
-       }
+       } while (++next);
 
        _leave("");
 }




_______________________________________________
stable mailing list
stable@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to