pages = &data->args.pages[base >> PAGE_CACHE_SHIFT];
        base &= ~PAGE_CACHE_MASK;
        pglen = PAGE_CACHE_SIZE - base;
-       if (pglen < remainder)
+       for (;;) {
+               if (remainder <= pglen) {
+                       memclear_highpage_flush(*pages, base, remainder);
+                       break;
+               }
                memclear_highpage_flush(*pages, base, pglen);
-       else
-               memclear_highpage_flush(*pages, base, remainder);
+               pages++;
+               remainder -= pglen;
+               pglen = PAGE_CACHE_SIZE;
+               base = 0;
+       }
 }
 
 /*
        unsigned int base = data->args.pgbase;
        struct page **pages;
 
+       if (data->res.eof)
+               count = data->args.count;
        if (unlikely(count == 0))
                return;
        pages = &data->args.pages[base >> PAGE_CACHE_SHIFT];
        count += base;
        for (;count >= PAGE_CACHE_SIZE; count -= PAGE_CACHE_SIZE, pages++)
                SetPageUptodate(*pages);
-       /*
-        * Was this an eof or a short read? If the latter, don't mark the page
-        * as uptodate yet.
-        */
-       if (count > 0 && (data->res.eof || data->args.count == data->res.count))
+       if (count != 0)
                SetPageUptodate(*pages);
 }
 
        count += base;
        for (;count >= PAGE_CACHE_SIZE; count -= PAGE_CACHE_SIZE, pages++)
                SetPageError(*pages);
+       if (count != 0)
+               SetPageError(*pages);
 }
 
 /*