if (wbc->range_cyclic) {
                index = mapping->writeback_index; /* Start from prev offset */
                end = -1;
+               /*
+                * Start from the beginning does not need to cycle over the
+                * range, mark it as scanned.
+                */
+               scanned = (index == 0);
        } else {
                index = wbc->range_start >> PAGE_SHIFT;
                end = wbc->range_end >> PAGE_SHIFT;
                        tag))) {
                unsigned i;
 
-               scanned = 1;
                for (i = 0; i < nr_pages; i++) {
                        struct page *page = pvec.pages[i];
 
        if (wbc->range_cyclic) {
                index = mapping->writeback_index; /* Start from prev offset */
                end = -1;
+               /*
+                * Start from the beginning does not need to cycle over the
+                * range, mark it as scanned.
+                */
+               scanned = (index == 0);
        } else {
                index = wbc->range_start >> PAGE_SHIFT;
                end = wbc->range_end >> PAGE_SHIFT;
                                                &index, end, tag))) {
                unsigned i;
 
-               scanned = 1;
                for (i = 0; i < nr_pages; i++) {
                        struct page *page = pvec.pages[i];