writeback: move last_active to bdi
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sun, 25 Jul 2010 11:29:18 +0000 (14:29 +0300)
committerJens Axboe <jaxboe@fusionio.com>
Sat, 7 Aug 2010 16:53:56 +0000 (18:53 +0200)
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>
fs/fs-writeback.c
include/linux/backing-dev.h

index 57fbfd0..9f5cab7 100644 (file)
@@ -800,12 +800,12 @@ int bdi_writeback_thread(void *data)
 {
        struct bdi_writeback *wb = data;
        struct backing_dev_info *bdi = wb->bdi;
-       unsigned long last_active = jiffies;
        unsigned long wait_jiffies = -1UL;
        long pages_written;
 
        current->flags |= PF_FLUSHER | PF_SWAPWRITE;
        set_freezable();
+       wb->last_active = jiffies;
 
        /*
         * Our parent may run at a different priority, just set us to normal
@@ -827,7 +827,7 @@ int bdi_writeback_thread(void *data)
                trace_writeback_pages_written(pages_written);
 
                if (pages_written)
-                       last_active = jiffies;
+                       wb->last_active = jiffies;
                else if (wait_jiffies != -1UL) {
                        unsigned long max_idle;
 
@@ -837,7 +837,7 @@ int bdi_writeback_thread(void *data)
                         * recreated automatically.
                         */
                        max_idle = max(5UL * 60 * HZ, wait_jiffies);
-                       if (time_after(jiffies, max_idle + last_active))
+                       if (time_after(jiffies, max_idle + wb->last_active))
                                break;
                }
 
index 95ecb2b..71b6223 100644 (file)
@@ -45,15 +45,16 @@ enum bdi_stat_item {
 #define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids)))
 
 struct bdi_writeback {
-       struct backing_dev_info *bdi;           /* our parent bdi */
+       struct backing_dev_info *bdi;   /* our parent bdi */
        unsigned int nr;
 
-       unsigned long last_old_flush;           /* last old data flush */
+       unsigned long last_old_flush;   /* last old data flush */
+       unsigned long last_active;      /* last time bdi thread was active */
 
-       struct task_struct      *task;          /* writeback thread */
-       struct list_head        b_dirty;        /* dirty inodes */
-       struct list_head        b_io;           /* parked for writeback */
-       struct list_head        b_more_io;      /* parked for more writeback */
+       struct task_struct *task;       /* writeback thread */
+       struct list_head b_dirty;       /* dirty inodes */
+       struct list_head b_io;          /* parked for writeback */
+       struct list_head b_more_io;     /* parked for more writeback */
 };
 
 struct backing_dev_info {