aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorMatthew Garrett <mjg@redhat.com>2010-04-06 08:25:14 -0400
committerJens Axboe <jens.axboe@oracle.com>2010-04-06 08:25:14 -0400
commit31373d09da5b7fe21fe6f781e92bd534a3495f00 (patch)
tree38cd9896cfc6ce106a03431658a9b98a09129034 /block
parent9195291e5f05e01d67f9a09c756b8aca8f009089 (diff)
laptop-mode: Make flushes per-device
One of the features of laptop-mode is that it forces a writeout of dirty pages if something else triggers a physical read or write from a device. The current implementation flushes pages on all devices, rather than only the one that triggered the flush. This patch alters the behaviour so that only the recently accessed block device is flushed, preventing other disks being spun up for no terribly good reason. Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 1d94f15d7f0d..4b1b29ef2cb0 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -451,6 +451,7 @@ void blk_cleanup_queue(struct request_queue *q)
451 */ 451 */
452 blk_sync_queue(q); 452 blk_sync_queue(q);
453 453
454 del_timer_sync(&q->backing_dev_info.laptop_mode_wb_timer);
454 mutex_lock(&q->sysfs_lock); 455 mutex_lock(&q->sysfs_lock);
455 queue_flag_set_unlocked(QUEUE_FLAG_DEAD, q); 456 queue_flag_set_unlocked(QUEUE_FLAG_DEAD, q);
456 mutex_unlock(&q->sysfs_lock); 457 mutex_unlock(&q->sysfs_lock);
@@ -511,6 +512,8 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
511 return NULL; 512 return NULL;
512 } 513 }
513 514
515 setup_timer(&q->backing_dev_info.laptop_mode_wb_timer,
516 laptop_mode_timer_fn, (unsigned long) q);
514 init_timer(&q->unplug_timer); 517 init_timer(&q->unplug_timer);
515 setup_timer(&q->timeout, blk_rq_timed_out_timer, (unsigned long) q); 518 setup_timer(&q->timeout, blk_rq_timed_out_timer, (unsigned long) q);
516 INIT_LIST_HEAD(&q->timeout_list); 519 INIT_LIST_HEAD(&q->timeout_list);
@@ -2101,7 +2104,7 @@ static void blk_finish_request(struct request *req, int error)
2101 BUG_ON(blk_queued_rq(req)); 2104 BUG_ON(blk_queued_rq(req));
2102 2105
2103 if (unlikely(laptop_mode) && blk_fs_request(req)) 2106 if (unlikely(laptop_mode) && blk_fs_request(req))
2104 laptop_io_completion(); 2107 laptop_io_completion(&req->q->backing_dev_info);
2105 2108
2106 blk_delete_timer(req); 2109 blk_delete_timer(req);
2107 2110