]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - mm/page-writeback.c
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
[karo-tx-linux.git] / mm / page-writeback.c
index 2359608d2568ac027dfdbcd901fa01d58e77f17a..143c1c25d680c272eefd1e2ee7f58a0043d4f8b1 100644 (file)
@@ -2352,10 +2352,16 @@ int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
 
        if (wbc->nr_to_write <= 0)
                return 0;
-       if (mapping->a_ops->writepages)
-               ret = mapping->a_ops->writepages(mapping, wbc);
-       else
-               ret = generic_writepages(mapping, wbc);
+       while (1) {
+               if (mapping->a_ops->writepages)
+                       ret = mapping->a_ops->writepages(mapping, wbc);
+               else
+                       ret = generic_writepages(mapping, wbc);
+               if ((ret != -ENOMEM) || (wbc->sync_mode != WB_SYNC_ALL))
+                       break;
+               cond_resched();
+               congestion_wait(BLK_RW_ASYNC, HZ/50);
+       }
        return ret;
 }