git.openpandora.org
/
pandora-kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
writeback: pay attention to wbc->nr_to_write in write_cache_pages
[pandora-kernel.git]
/
mm
/
page-writeback.c
diff --git
a/mm/page-writeback.c
b/mm/page-writeback.c
index
0b19943
..
b3dbb80
100644
(file)
--- a/
mm/page-writeback.c
+++ b/
mm/page-writeback.c
@@
-683,10
+683,6
@@
void throttle_vm_writeout(gfp_t gfp_mask)
}
}
}
}
-static void laptop_timer_fn(unsigned long unused);
-
-static DEFINE_TIMER(laptop_mode_wb_timer, laptop_timer_fn, 0, 0);
-
/*
* sysctl handler for /proc/sys/vm/dirty_writeback_centisecs
*/
/*
* sysctl handler for /proc/sys/vm/dirty_writeback_centisecs
*/
@@
-694,24
+690,24
@@
int dirty_writeback_centisecs_handler(ctl_table *table, int write,
void __user *buffer, size_t *length, loff_t *ppos)
{
proc_dointvec(table, write, buffer, length, ppos);
void __user *buffer, size_t *length, loff_t *ppos)
{
proc_dointvec(table, write, buffer, length, ppos);
+ bdi_arm_supers_timer();
return 0;
}
return 0;
}
-static void do_laptop_sync(struct work_struct *work)
+#ifdef CONFIG_BLOCK
+void laptop_mode_timer_fn(unsigned long data)
{
{
-
wakeup_flusher_threads(0)
;
- kfree(work);
-}
+
struct request_queue *q = (struct request_queue *)data
;
+ int nr_pages = global_page_state(NR_FILE_DIRTY) +
+ global_page_state(NR_UNSTABLE_NFS);
-static void laptop_timer_fn(unsigned long unused)
-{
- struct work_struct *work;
+ /*
+ * We want to write everything out, not just down to the dirty
+ * threshold
+ */
- work = kmalloc(sizeof(*work), GFP_ATOMIC);
- if (work) {
- INIT_WORK(work, do_laptop_sync);
- schedule_work(work);
- }
+ if (bdi_has_dirty_io(&q->backing_dev_info))
+ bdi_start_writeback(&q->backing_dev_info, NULL, nr_pages);
}
/*
}
/*
@@
-719,9
+715,9
@@
static void laptop_timer_fn(unsigned long unused)
* of all dirty data a few seconds from now. If the flush is already scheduled
* then push it back - the user is still using the disk.
*/
* of all dirty data a few seconds from now. If the flush is already scheduled
* then push it back - the user is still using the disk.
*/
-void laptop_io_completion(
void
)
+void laptop_io_completion(
struct backing_dev_info *info
)
{
{
- mod_timer(&laptop_mode_wb_timer, jiffies + laptop_mode);
+ mod_timer(&
info->
laptop_mode_wb_timer, jiffies + laptop_mode);
}
/*
}
/*
@@
-731,8
+727,16
@@
void laptop_io_completion(void)
*/
void laptop_sync_completion(void)
{
*/
void laptop_sync_completion(void)
{
- del_timer(&laptop_mode_wb_timer);
+ struct backing_dev_info *bdi;
+
+ rcu_read_lock();
+
+ list_for_each_entry_rcu(bdi, &bdi_list, bdi_list)
+ del_timer(&bdi->laptop_mode_wb_timer);
+
+ rcu_read_unlock();
}
}
+#endif
/*
* If ratelimit_pages is too high then we can get into dirty-data overload
/*
* If ratelimit_pages is too high then we can get into dirty-data overload
@@
-831,7
+835,6
@@
int write_cache_pages(struct address_space *mapping,
pgoff_t done_index;
int cycled;
int range_whole = 0;
pgoff_t done_index;
int cycled;
int range_whole = 0;
- long nr_to_write = wbc->nr_to_write;
pagevec_init(&pvec, 0);
if (wbc->range_cyclic) {
pagevec_init(&pvec, 0);
if (wbc->range_cyclic) {
@@
-931,11
+934,10
@@
continue_unlock:
done = 1;
break;
}
done = 1;
break;
}
- }
+ }
- if (nr_to_write > 0) {
- nr_to_write--;
- if (nr_to_write == 0 &&
+ if (wbc->nr_to_write > 0) {
+ if (--wbc->nr_to_write == 0 &&
wbc->sync_mode == WB_SYNC_NONE) {
/*
* We stop writing back only if we are
wbc->sync_mode == WB_SYNC_NONE) {
/*
* We stop writing back only if we are
@@
-966,11
+968,8
@@
continue_unlock:
end = writeback_index - 1;
goto retry;
}
end = writeback_index - 1;
goto retry;
}
- if (!wbc->no_nrwrite_index_update) {
- if (wbc->range_cyclic || (range_whole && nr_to_write > 0))
- mapping->writeback_index = done_index;
- wbc->nr_to_write = nr_to_write;
- }
+ if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
+ mapping->writeback_index = done_index;
return ret;
}
return ret;
}