[PATCH] Swap Migration V5: PF_SWAPWRITE to allow writing to swap
[pandora-kernel.git] / mm / page-writeback.c
index a6329fa..5240e42 100644 (file)
@@ -368,10 +368,8 @@ int wakeup_pdflush(long nr_pages)
 static void wb_timer_fn(unsigned long unused);
 static void laptop_timer_fn(unsigned long unused);
 
-static struct timer_list wb_timer =
-                       TIMER_INITIALIZER(wb_timer_fn, 0, 0);
-static struct timer_list laptop_mode_wb_timer =
-                       TIMER_INITIALIZER(laptop_timer_fn, 0, 0);
+static DEFINE_TIMER(wb_timer, wb_timer_fn, 0, 0);
+static DEFINE_TIMER(laptop_mode_wb_timer, laptop_timer_fn, 0, 0);
 
 /*
  * Periodic writeback of "old" data.
@@ -552,11 +550,17 @@ void __init page_writeback_init(void)
 
 int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
 {
+       int ret;
+
        if (wbc->nr_to_write <= 0)
                return 0;
+       wbc->for_writepages = 1;
        if (mapping->a_ops->writepages)
-               return mapping->a_ops->writepages(mapping, wbc);
-       return generic_writepages(mapping, wbc);
+               ret =  mapping->a_ops->writepages(mapping, wbc);
+       else
+               ret = generic_writepages(mapping, wbc);
+       wbc->for_writepages = 0;
+       return ret;
 }
 
 /**