aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/cfq-iosched.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 0d3b70de3d80..0eb4aff9df68 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,
1908 sector_t sdist; 1908 sector_t sdist;
1909 u64 total; 1909 u64 total;
1910 1910
1911 if (cic->last_request_pos < rq->sector) 1911 if (!cic->last_request_pos)
1912 sdist = 0;
1913 else if (cic->last_request_pos < rq->sector)
1912 sdist = rq->sector - cic->last_request_pos; 1914 sdist = rq->sector - cic->last_request_pos;
1913 else 1915 else
1914 sdist = cic->last_request_pos - rq->sector; 1916 sdist = cic->last_request_pos - rq->sector;