]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - mm/page-writeback.c
Merge branch 'for-2.6.39/core' of git://git.kernel.dk/linux-2.6-block
[mirror_ubuntu-artful-kernel.git] / mm / page-writeback.c
index 24b7ac2bc36b558eace70cae46e5781ac304368f..31f698862420021cc9b1e39e608077d1d468730a 100644 (file)
@@ -927,7 +927,7 @@ retry:
                                break;
                        }
 
-                       done_index = page->index + 1;
+                       done_index = page->index;
 
                        lock_page(page);
 
@@ -977,6 +977,7 @@ continue_unlock:
                                         * not be suitable for data integrity
                                         * writeout).
                                         */
+                                       done_index = page->index + 1;
                                        done = 1;
                                        break;
                                }
@@ -1217,6 +1218,17 @@ int set_page_dirty(struct page *page)
 
        if (likely(mapping)) {
                int (*spd)(struct page *) = mapping->a_ops->set_page_dirty;
+               /*
+                * readahead/lru_deactivate_page could remain
+                * PG_readahead/PG_reclaim due to race with end_page_writeback
+                * About readahead, if the page is written, the flags would be
+                * reset. So no problem.
+                * About lru_deactivate_page, if the page is redirty, the flag
+                * will be reset. So no problem. but if the page is used by readahead
+                * it will confuse readahead and make it restart the size rampup
+                * process. But it's a trivial problem.
+                */
+               ClearPageReclaim(page);
 #ifdef CONFIG_BLOCK
                if (!spd)
                        spd = __set_page_dirty_buffers;
@@ -1272,7 +1284,6 @@ int clear_page_dirty_for_io(struct page *page)
 
        BUG_ON(!PageLocked(page));
 
-       ClearPageReclaim(page);
        if (mapping && mapping_cap_account_dirty(mapping)) {
                /*
                 * Yes, Virginia, this is indeed insane.