diff options
-rw-r--r-- | block/cfq-iosched.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 0d3b70de3d8..0eb4aff9df6 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -1908,7 +1908,9 @@ cfq_update_io_seektime(struct cfq_data *cfqd, struct cfq_io_context *cic, sector_t sdist; u64 total; - if (cic->last_request_pos < rq->sector) + if (!cic->last_request_pos) + sdist = 0; + else if (cic->last_request_pos < rq->sector) sdist = rq->sector - cic->last_request_pos; else sdist = cic->last_request_pos - rq->sector; |