diff options
author | Jeff Moyer <jmoyer@redhat.com> | 2009-04-21 07:31:56 +0200 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-04-22 08:35:11 +0200 |
commit | 04dc6e71a28d4815bf9431efcafc107bb0ad2792 (patch) | |
tree | dd51f2491b984d9f8f571f2bdc6b51cadb8c686d | |
parent | 4d00aa47e2337dcfe2d8a7215dbde3765b507167 (diff) | |
download | linux-3.10-04dc6e71a28d4815bf9431efcafc107bb0ad2792.tar.gz linux-3.10-04dc6e71a28d4815bf9431efcafc107bb0ad2792.tar.bz2 linux-3.10-04dc6e71a28d4815bf9431efcafc107bb0ad2792.zip |
cfq-iosched: use the default seek distance when there aren't enough seek samples
If the cfq io context doesn't have enough samples yet to provide a mean
seek distance, then use the default threshold we have for seeky IO instead
of defaulting to 0.
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | block/cfq-iosched.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 0eb4aff9df6..7e13f04b5ed 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -947,14 +947,18 @@ static inline sector_t cfq_dist_from_last(struct cfq_data *cfqd, return cfqd->last_position - rq->sector; } +#define CIC_SEEK_THR 8 * 1024 +#define CIC_SEEKY(cic) ((cic)->seek_mean > CIC_SEEK_THR) + static inline int cfq_rq_close(struct cfq_data *cfqd, struct request *rq) { struct cfq_io_context *cic = cfqd->active_cic; + sector_t sdist = cic->seek_mean; if (!sample_valid(cic->seek_samples)) - return 0; + sdist = CIC_SEEK_THR; - return cfq_dist_from_last(cfqd, rq) <= cic->seek_mean; + return cfq_dist_from_last(cfqd, rq) <= sdist; } static struct cfq_queue *cfqq_close(struct cfq_data *cfqd, @@ -1039,9 +1043,6 @@ static struct cfq_queue *cfq_close_cooperator(struct cfq_data *cfqd, return cfqq; } - -#define CIC_SEEKY(cic) ((cic)->seek_mean > (8 * 1024)) - static void cfq_arm_slice_timer(struct cfq_data *cfqd) { struct cfq_queue *cfqq = cfqd->active_queue; |