Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b307d465 authored by Jan Beulich's avatar Jan Beulich Committed by Linus Torvalds
Browse files

FS-Cache: Fix __fscache_uncache_all_inode_pages()'s outer loop



The compiler, at least for ix86 and m68k, 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.

On m68k the following warning is observed:

  fs/fscache/page.c: In function '__fscache_uncache_all_inode_pages':
  fs/fscache/page.c:979: warning: comparison is always false due to limited range of data type

Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Reported-by: default avatarJan Beulich <jbeulich@novell.com>
Signed-off-by: default avatarJan Beulich <jbeulich@novell.com>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Cc: Suresh Jayaraman <sjayaraman@suse.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: stable@kernel.org
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent cf6ace16
Loading
Loading
Loading
Loading
+5 −9
Original line number Original line Diff line number Diff line
@@ -976,16 +976,12 @@ void __fscache_uncache_all_inode_pages(struct fscache_cookie *cookie,


	pagevec_init(&pvec, 0);
	pagevec_init(&pvec, 0);
	next = 0;
	next = 0;
	while (next <= (loff_t)-1 &&
	do {
	       pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)
		if (!pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE))
	       ) {
			break;
		for (i = 0; i < pagevec_count(&pvec); i++) {
		for (i = 0; i < pagevec_count(&pvec); i++) {
			struct page *page = pvec.pages[i];
			struct page *page = pvec.pages[i];
			pgoff_t page_index = page->index;
			next = page->index;

			ASSERTCMP(page_index, >=, next);
			next = page_index + 1;

			if (PageFsCache(page)) {
			if (PageFsCache(page)) {
				__fscache_wait_on_page_write(cookie, page);
				__fscache_wait_on_page_write(cookie, page);
				__fscache_uncache_page(cookie, page);
				__fscache_uncache_page(cookie, page);
@@ -993,7 +989,7 @@ void __fscache_uncache_all_inode_pages(struct fscache_cookie *cookie,
		}
		}
		pagevec_release(&pvec);
		pagevec_release(&pvec);
		cond_resched();
		cond_resched();
	}
	} while (++next);


	_leave("");
	_leave("");
}
}