Skip to content

Commit ecd5840

Browse files
Artem BityutskiyJens Axboe
authored andcommitted
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>
1 parent 78c40cb commit ecd5840

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

‎fs/fs-writeback.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -800,12 +800,12 @@ int bdi_writeback_thread(void *data)
800800
{
801801
struct bdi_writeback *wb = data;
802802
struct backing_dev_info *bdi = wb->bdi;
803-
unsigned long last_active = jiffies;
804803
unsigned long wait_jiffies = -1UL;
805804
long pages_written;
806805

807806
current->flags |= PF_FLUSHER | PF_SWAPWRITE;
808807
set_freezable();
808+
wb->last_active = jiffies;
809809

810810
/*
811811
* Our parent may run at a different priority, just set us to normal
@@ -827,7 +827,7 @@ int bdi_writeback_thread(void *data)
827827
trace_writeback_pages_written(pages_written);
828828

829829
if (pages_written)
830-
last_active = jiffies;
830+
wb->last_active = jiffies;
831831
else if (wait_jiffies != -1UL) {
832832
unsigned long max_idle;
833833

@@ -837,7 +837,7 @@ int bdi_writeback_thread(void *data)
837837
* recreated automatically.
838838
*/
839839
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))
841841
break;
842842
}
843843

‎include/linux/backing-dev.h‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,16 @@ enum bdi_stat_item {
4545
#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids)))
4646

4747
struct bdi_writeback {
48-
struct backing_dev_info *bdi; /* our parent bdi */
48+
struct backing_dev_info *bdi; /* our parent bdi */
4949
unsigned int nr;
5050

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 */
5253

53-
struct task_struct *task; /* writeback thread */
54-
struct list_head b_dirty; /* dirty inodes */
55-
struct list_head b_io; /* parked for writeback */
56-
struct list_head b_more_io; /* parked for more writeback */
54+
struct task_struct *task; /* writeback thread */
55+
struct list_head b_dirty; /* dirty inodes */
56+
struct list_head b_io; /* parked for writeback */
57+
struct list_head b_more_io; /* parked for more writeback */
5758
};
5859

5960
struct backing_dev_info {

0 commit comments

Comments
 (0)