GIT f3612d860803340ed6a12214812e151b0dce97a8 git+ssh://master.kernel.org/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git#for-akpm commit Author: Aaron Carroll Date: Wed Dec 5 21:07:07 2007 +1100 as-iosched: fix write batch start point New write batches currently start from where the last one completed. We have no idea where the head is after switching batches, so this makes little sense. Instead, start the next batch from the request with the earliest deadline in the hope that we avoid a deadline expiry later on. Signed-off-by: Aaron Carroll Acked-by: Nick Piggin Signed-off-by: Jens Axboe commit debdee5b9b8546927c0ac0ad29e13d5ae6bddf80 Author: Aaron Carroll Date: Wed Dec 5 21:06:50 2007 +1100 as-iosched: fix incorrect comments Two comments refer to deadlines applying to reads only. This is not the case. Signed-off-by: Aaron Carroll Acked-by: Nick Piggin Signed-off-by: Jens Axboe commit f79f7a6809c310546a9752a9d2fa6f72e4e8fd96 Author: Tejun Heo Date: Wed Dec 5 21:28:24 2007 +0100 block: use jiffies conversion functions in scsi_ioctl.c Use msecs_to_jiffies() and jiffies_to_msecs() in scsi_ioctl(). Sometimes callers use very large values for e.g. vendor specific media clear command and calculation can overflow. Signed-off-by: Tejun Heo Signed-off-by: Jens Axboe block/as-iosched.c | 7 ++++--- block/scsi_ioctl.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/block/as-iosched.c b/block/as-iosched.c index dc715a5..555cd6b 100644 --- a/block/as-iosched.c +++ b/block/as-iosched.c @@ -880,7 +880,7 @@ static void as_remove_queued_request(struct request_queue *q, } /* - * as_fifo_expired returns 0 if there are no expired reads on the fifo, + * as_fifo_expired returns 0 if there are no expired requests on the fifo, * 1 otherwise. It is ratelimited so that we only perform the check once per * `fifo_expire' interval. Otherwise a large number of expired requests * would create a hopeless seekstorm. @@ -1097,7 +1097,8 @@ dispatch_writes: ad->batch_data_dir = REQ_ASYNC; ad->current_write_count = ad->write_batch_count; ad->write_batch_idled = 0; - rq = ad->next_rq[ad->batch_data_dir]; + rq = rq_entry_fifo(ad->fifo_list[REQ_ASYNC].next); + ad->last_check_fifo[REQ_ASYNC] = jiffies; goto dispatch_request; } @@ -1159,7 +1160,7 @@ static void as_add_request(struct request_queue *q, struct request *rq) as_add_rq_rb(ad, rq); /* - * set expire time (only used for reads) and add to fifo list + * set expire time and add to fifo list */ rq_set_fifo_time(rq, jiffies + ad->fifo_expire[data_dir]); list_add_tail(&rq->queuelist, &ad->fifo_list[data_dir]); diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 91c7322..9675b34 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -230,7 +230,7 @@ static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq, rq->cmd_len = hdr->cmd_len; rq->cmd_type = REQ_TYPE_BLOCK_PC; - rq->timeout = (hdr->timeout * HZ) / 1000; + rq->timeout = msecs_to_jiffies(hdr->timeout); if (!rq->timeout) rq->timeout = q->sg_timeout; if (!rq->timeout) @@ -366,7 +366,7 @@ static int sg_io(struct file *file, struct request_queue *q, */ blk_execute_rq(q, bd_disk, rq, 0); - hdr->duration = ((jiffies - start_time) * 1000) / HZ; + hdr->duration = jiffies_to_msecs(jiffies - start_time); return blk_complete_sghdr_rq(rq, hdr, bio); out: