aboutsummaryrefslogtreecommitdiffstats
path: root/xenolinux-2.4.22-sparse/drivers/block/ll_rw_blk.c
diff options
context:
space:
mode:
authoriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2003-12-19 14:38:15 +0000
committeriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2003-12-19 14:38:15 +0000
commit24e81789606925507a369a624941c7bbab793735 (patch)
tree4f9b3c3bcafc3357a3ec41fd071742e69bceb1b6 /xenolinux-2.4.22-sparse/drivers/block/ll_rw_blk.c
parent49836d9d4f67e92796cf8d68ad4361b448bd7d9d (diff)
parent8708081a01a064f8356f580445cc57f6aa2b9648 (diff)
downloadxen-24e81789606925507a369a624941c7bbab793735.tar.gz
xen-24e81789606925507a369a624941c7bbab793735.tar.bz2
xen-24e81789606925507a369a624941c7bbab793735.zip
bitkeeper revision 1.651 (3fe30d57DatlAZVUHwbVCkF4_TelxA)
Merge labyrinth.cl.cam.ac.uk:/usr/groups/xeno/BK/xeno.bk into labyrinth.cl.cam.ac.uk:/auto/anfs/scratch/labyrinth/iap10/xeno-clone/xeno.bk
Diffstat (limited to 'xenolinux-2.4.22-sparse/drivers/block/ll_rw_blk.c')
-rw-r--r--xenolinux-2.4.22-sparse/drivers/block/ll_rw_blk.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/xenolinux-2.4.22-sparse/drivers/block/ll_rw_blk.c b/xenolinux-2.4.22-sparse/drivers/block/ll_rw_blk.c
index f42c17d026..bca30ae493 100644
--- a/xenolinux-2.4.22-sparse/drivers/block/ll_rw_blk.c
+++ b/xenolinux-2.4.22-sparse/drivers/block/ll_rw_blk.c
@@ -121,6 +121,10 @@ int * max_sectors[MAX_BLKDEV];
unsigned long blk_max_low_pfn, blk_max_pfn;
int blk_nohighio = 0;
+int block_dump = 0;
+
+static struct timer_list writeback_timer;
+
static inline int get_max_sectors(kdev_t dev)
{
if (!max_sectors[MAJOR(dev)])
@@ -1293,6 +1297,9 @@ void submit_bh(int rw, struct buffer_head * bh)
if (waitqueue_active(&bh->b_wait))
wake_up(&bh->b_wait);
+ if (block_dump)
+ printk(KERN_DEBUG "%s: %s block %lu/%u on %s\n", current->comm, rw == WRITE ? "WRITE" : "READ", bh->b_rsector, count, kdevname(bh->b_rdev));
+
put_bh(bh);
switch (rw) {
case WRITE:
@@ -1413,6 +1420,11 @@ sorry:
extern int stram_device_init (void);
#endif
+static void blk_writeback_timer(unsigned long data)
+{
+ wakeup_bdflush();
+ wakeup_kupdate();
+}
/**
* end_that_request_first - end I/O on one buffer.
@@ -1469,10 +1481,18 @@ int end_that_request_first (struct request *req, int uptodate, char *name)
return 0;
}
+extern int laptop_mode;
+
void end_that_request_last(struct request *req)
{
struct completion *waiting = req->waiting;
+ /*
+ * schedule the writeout of pending dirty data when the disk is idle
+ */
+ if (laptop_mode && req->cmd == READ)
+ mod_timer(&writeback_timer, jiffies + 5 * HZ);
+
req_finished_io(req);
blkdev_release_request(req);
if (waiting)
@@ -1500,6 +1520,9 @@ int __init blk_dev_init(void)
blk_max_low_pfn = max_low_pfn - 1;
blk_max_pfn = max_pfn - 1;
+ init_timer(&writeback_timer);
+ writeback_timer.function = blk_writeback_timer;
+
#ifdef CONFIG_AMIGA_Z2RAM
z2_init();
#endif