The wb_wakeup_delayed is only used in fs-writeback.c. Move it to fs-writeback.c after defination of wb_wakeup and make it static.
Unified · Split
| @@ -141,6 +141,31 @@ static void wb_wakeup(struct bdi_writeback *wb) · 140 unmodified lines | ||
| 141 | 141 | spin_unlock_irq(&wb->work_lock); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | +/* | |
| 145 | + * This function is used when the first inode for this wb is marked dirty. It | |
| 146 | + * wakes-up the corresponding bdi thread which should then take care of the | |
| 147 | + * periodic background write-out of dirty inodes. Since the write-out would | |
| 148 | + * starts only 'dirty_writeback_interval' centisecs from now anyway, we just | |
| 149 | + * set up a timer which wakes the bdi thread up later. | |
| 150 | + * | |
| 151 | + * Note, we wouldn't bother setting up the timer, but this function is on the | |
| 152 | + * fast-path (used by '__mark_inode_dirty()'), so we save few context switches | |
| 153 | + * by delaying the wake-up. | |
| 154 | + * | |
| 155 | + * We have to be careful not to postpone flush work if it is scheduled for | |
| 156 | + * earlier. Thus we use queue_delayed_work(). | |
| 157 | + */ | |
| 158 | +static void wb_wakeup_delayed(struct bdi_writeback *wb) | |
| 159 | +{ | |
| 160 | + unsigned long timeout; | |
| 161 | + | |
| 162 | + timeout = msecs_to_jiffies(dirty_writeback_interval * 10); | |
| 163 | + spin_lock_irq(&wb->work_lock); | |
| 164 | + if (test_bit(WB_registered, &wb->state)) | |
| 165 | + queue_delayed_work(bdi_wq, &wb->dwork, timeout); | |
| 166 | + spin_unlock_irq(&wb->work_lock); | |
| 167 | +} | |
| 168 | + | |
| 144 | 169 | static void finish_writeback_work(struct bdi_writeback *wb, |
| 145 | 170 | struct wb_writeback_work *work) |
| 146 | 171 | { |
| @@ -38,7 +38,6 @@ struct backing_dev_info *bdi_alloc(int node_id); · 37 unmodified lines | ||
| 38 | 38 | |
| 39 | 39 | void wb_start_background_writeback(struct bdi_writeback *wb); |
| 40 | 40 | void wb_workfn(struct work_struct *work); |
| 41 | −void wb_wakeup_delayed(struct bdi_writeback *wb); | |
| 42 | 41 | |
| 43 | 42 | void wb_wait_for_completion(struct wb_completion *done); |
| 44 | 43 | |
| @@ -372,31 +372,6 @@ static int __init default_bdi_init(void) · 371 unmodified lines | ||
| 372 | 372 | } |
| 373 | 373 | subsys_initcall(default_bdi_init); |
| 374 | 374 | |
| 375 | −/* | |
| 376 | − * This function is used when the first inode for this wb is marked dirty. It | |
| 377 | − * wakes-up the corresponding bdi thread which should then take care of the | |
| 378 | − * periodic background write-out of dirty inodes. Since the write-out would | |
| 379 | − * starts only 'dirty_writeback_interval' centisecs from now anyway, we just | |
| 380 | − * set up a timer which wakes the bdi thread up later. | |
| 381 | − * | |
| 382 | − * Note, we wouldn't bother setting up the timer, but this function is on the | |
| 383 | − * fast-path (used by '__mark_inode_dirty()'), so we save few context switches | |
| 384 | − * by delaying the wake-up. | |
| 385 | − * | |
| 386 | − * We have to be careful not to postpone flush work if it is scheduled for | |
| 387 | − * earlier. Thus we use queue_delayed_work(). | |
| 388 | − */ | |
| 389 | −void wb_wakeup_delayed(struct bdi_writeback *wb) | |
| 390 | −{ | |
| 391 | − unsigned long timeout; | |
| 392 | − | |
| 393 | − timeout = msecs_to_jiffies(dirty_writeback_interval * 10); | |
| 394 | − spin_lock_irq(&wb->work_lock); | |
| 395 | − if (test_bit(WB_registered, &wb->state)) | |
| 396 | − queue_delayed_work(bdi_wq, &wb->dwork, timeout); | |
| 397 | − spin_unlock_irq(&wb->work_lock); | |
| 398 | −} | |
| 399 | − | |
| 400 | 375 | static void wb_update_bandwidth_workfn(struct work_struct *work) |
| 401 | 376 | { |
| 402 | 377 | struct bdi_writeback *wb = container_of(to_delayed_work(work), |