aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-07-25 07:29:18 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-08-07 12:53:56 -0400
commitecd584030da67ede1bf17955746a6ce834d9fc6b (patch)
tree3f26260102a84e8cb047249e65cdde6b9aadcb96
parent78c40cb6581a74adc48821f3de6b864a54d4c34d (diff)
writeback: move last_active to bdi
Currently bdi threads use local variable 'last_active' which stores last time when the bdi thread did some useful work. Move this local variable to 'struct bdi_writeback'. This is just a preparation for the further patches which will make the forker thread decide when bdi threads should be killed. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
-rw-r--r--fs/fs-writeback.c6
-rw-r--r--include/linux/backing-dev.h13
2 files changed, 10 insertions, 9 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 57fbfd0ebc52..9f5cab75c157 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -800,12 +800,12 @@ int bdi_writeback_thread(void *data)
800{ 800{
801 struct bdi_writeback *wb = data; 801 struct bdi_writeback *wb = data;
802 struct backing_dev_info *bdi = wb->bdi; 802 struct backing_dev_info *bdi = wb->bdi;
803 unsigned long last_active = jiffies;
804 unsigned long wait_jiffies = -1UL; 803 unsigned long wait_jiffies = -1UL;
805 long pages_written; 804 long pages_written;
806 805
807 current->flags |= PF_FLUSHER | PF_SWAPWRITE; 806 current->flags |= PF_FLUSHER | PF_SWAPWRITE;
808 set_freezable(); 807 set_freezable();
808 wb->last_active = jiffies;
809 809
810 /* 810 /*
811 * Our parent may run at a different priority, just set us to normal 811 * Our parent may run at a different priority, just set us to normal
@@ -827,7 +827,7 @@ int bdi_writeback_thread(void *data)
827 trace_writeback_pages_written(pages_written); 827 trace_writeback_pages_written(pages_written);
828 828
829 if (pages_written) 829 if (pages_written)
830 last_active = jiffies; 830 wb->last_active = jiffies;
831 else if (wait_jiffies != -1UL) { 831 else if (wait_jiffies != -1UL) {
832 unsigned long max_idle; 832 unsigned long max_idle;
833 833
@@ -837,7 +837,7 @@ int bdi_writeback_thread(void *data)
837 * recreated automatically. 837 * recreated automatically.
838 */ 838 */
839 max_idle = max(5UL * 60 * HZ, wait_jiffies); 839 max_idle = max(5UL * 60 * HZ, wait_jiffies);
840 if (time_after(jiffies, max_idle + last_active)) 840 if (time_after(jiffies, max_idle + wb->last_active))
841 break; 841 break;
842 } 842 }
843 843
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 95ecb2bebca8..71b6223e0a77 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -45,15 +45,16 @@ enum bdi_stat_item {
45#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids))) 45#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids)))
46 46
47struct bdi_writeback { 47struct bdi_writeback {
48 struct backing_dev_info *bdi; /* our parent bdi */ 48 struct backing_dev_info *bdi; /* our parent bdi */
49 unsigned int nr; 49 unsigned int nr;
50 50
51 unsigned long last_old_flush; /* last old data flush */ 51 unsigned long last_old_flush; /* last old data flush */
52 unsigned long last_active; /* last time bdi thread was active */
52 53
53 struct task_struct *task; /* writeback thread */ 54 struct task_struct *task; /* writeback thread */
54 struct list_head b_dirty; /* dirty inodes */ 55 struct list_head b_dirty; /* dirty inodes */
55 struct list_head b_io; /* parked for writeback */ 56 struct list_head b_io; /* parked for writeback */
56 struct list_head b_more_io; /* parked for more writeback */ 57 struct list_head b_more_io; /* parked for more writeback */
57}; 58};
58 59
59struct backing_dev_info { 60struct backing_dev_info {