diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-03-18 13:38:01 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2006-03-18 18:34:02 -0500 |
commit | 12a057321529df2fb650ac5f34dfd7abcca667df (patch) | |
tree | b74a85a275cf97cebcd30aa544605081c80d7fb1 /block/cfq-iosched.c | |
parent | 478a82b0edeea1cc82a5f79880b3a15923a678de (diff) |
[PATCH] keep sync and async cfq_queue separate
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r-- | block/cfq-iosched.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 42f990f2763d..63bfe4b494ba 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -1219,11 +1219,20 @@ static void cfq_exit_single_io_context(struct cfq_io_context *cic) | |||
1219 | 1219 | ||
1220 | spin_lock(q->queue_lock); | 1220 | spin_lock(q->queue_lock); |
1221 | 1221 | ||
1222 | if (unlikely(cic->cfqq == cfqd->active_queue)) | 1222 | if (cic->cfqq[ASYNC]) { |
1223 | __cfq_slice_expired(cfqd, cic->cfqq, 0); | 1223 | if (unlikely(cic->cfqq[ASYNC] == cfqd->active_queue)) |
1224 | __cfq_slice_expired(cfqd, cic->cfqq[ASYNC], 0); | ||
1225 | cfq_put_queue(cic->cfqq[ASYNC]); | ||
1226 | cic->cfqq[ASYNC] = NULL; | ||
1227 | } | ||
1228 | |||
1229 | if (cic->cfqq[SYNC]) { | ||
1230 | if (unlikely(cic->cfqq[SYNC] == cfqd->active_queue)) | ||
1231 | __cfq_slice_expired(cfqd, cic->cfqq[SYNC], 0); | ||
1232 | cfq_put_queue(cic->cfqq[SYNC]); | ||
1233 | cic->cfqq[SYNC] = NULL; | ||
1234 | } | ||
1224 | 1235 | ||
1225 | cfq_put_queue(cic->cfqq); | ||
1226 | cic->cfqq = NULL; | ||
1227 | cic->key = NULL; | 1236 | cic->key = NULL; |
1228 | spin_unlock(q->queue_lock); | 1237 | spin_unlock(q->queue_lock); |
1229 | } | 1238 | } |
@@ -1259,7 +1268,8 @@ cfq_alloc_io_context(struct cfq_data *cfqd, gfp_t gfp_mask) | |||
1259 | 1268 | ||
1260 | if (cic) { | 1269 | if (cic) { |
1261 | INIT_LIST_HEAD(&cic->list); | 1270 | INIT_LIST_HEAD(&cic->list); |
1262 | cic->cfqq = NULL; | 1271 | cic->cfqq[ASYNC] = NULL; |
1272 | cic->cfqq[SYNC] = NULL; | ||
1263 | cic->key = NULL; | 1273 | cic->key = NULL; |
1264 | cic->last_end_request = jiffies; | 1274 | cic->last_end_request = jiffies; |
1265 | cic->ttime_total = 0; | 1275 | cic->ttime_total = 0; |
@@ -1325,7 +1335,12 @@ static inline void changed_ioprio(struct cfq_io_context *cic) | |||
1325 | struct cfq_queue *cfqq; | 1335 | struct cfq_queue *cfqq; |
1326 | if (cfqd) { | 1336 | if (cfqd) { |
1327 | spin_lock(cfqd->queue->queue_lock); | 1337 | spin_lock(cfqd->queue->queue_lock); |
1328 | cfqq = cic->cfqq; | 1338 | cfqq = cic->cfqq[ASYNC]; |
1339 | if (cfqq) { | ||
1340 | cfq_mark_cfqq_prio_changed(cfqq); | ||
1341 | cfq_init_prio_data(cfqq); | ||
1342 | } | ||
1343 | cfqq = cic->cfqq[SYNC]; | ||
1329 | if (cfqq) { | 1344 | if (cfqq) { |
1330 | cfq_mark_cfqq_prio_changed(cfqq); | 1345 | cfq_mark_cfqq_prio_changed(cfqq); |
1331 | cfq_init_prio_data(cfqq); | 1346 | cfq_init_prio_data(cfqq); |
@@ -1892,6 +1907,7 @@ cfq_set_request(request_queue_t *q, struct request *rq, struct bio *bio, | |||
1892 | struct cfq_queue *cfqq; | 1907 | struct cfq_queue *cfqq; |
1893 | struct cfq_rq *crq; | 1908 | struct cfq_rq *crq; |
1894 | unsigned long flags; | 1909 | unsigned long flags; |
1910 | int is_sync = key != CFQ_KEY_ASYNC; | ||
1895 | 1911 | ||
1896 | might_sleep_if(gfp_mask & __GFP_WAIT); | 1912 | might_sleep_if(gfp_mask & __GFP_WAIT); |
1897 | 1913 | ||
@@ -1902,14 +1918,14 @@ cfq_set_request(request_queue_t *q, struct request *rq, struct bio *bio, | |||
1902 | if (!cic) | 1918 | if (!cic) |
1903 | goto queue_fail; | 1919 | goto queue_fail; |
1904 | 1920 | ||
1905 | if (!cic->cfqq) { | 1921 | if (!cic->cfqq[is_sync]) { |
1906 | cfqq = cfq_get_queue(cfqd, key, tsk->ioprio, gfp_mask); | 1922 | cfqq = cfq_get_queue(cfqd, key, tsk->ioprio, gfp_mask); |
1907 | if (!cfqq) | 1923 | if (!cfqq) |
1908 | goto queue_fail; | 1924 | goto queue_fail; |
1909 | 1925 | ||
1910 | cic->cfqq = cfqq; | 1926 | cic->cfqq[is_sync] = cfqq; |
1911 | } else | 1927 | } else |
1912 | cfqq = cic->cfqq; | 1928 | cfqq = cic->cfqq[is_sync]; |
1913 | 1929 | ||
1914 | cfqq->allocated[rw]++; | 1930 | cfqq->allocated[rw]++; |
1915 | cfq_clear_cfqq_must_alloc(cfqq); | 1931 | cfq_clear_cfqq_must_alloc(cfqq); |
@@ -1926,7 +1942,7 @@ cfq_set_request(request_queue_t *q, struct request *rq, struct bio *bio, | |||
1926 | crq->cfq_queue = cfqq; | 1942 | crq->cfq_queue = cfqq; |
1927 | crq->io_context = cic; | 1943 | crq->io_context = cic; |
1928 | 1944 | ||
1929 | if (rw == READ || process_sync(tsk)) | 1945 | if (is_sync) |
1930 | cfq_mark_crq_is_sync(crq); | 1946 | cfq_mark_crq_is_sync(crq); |
1931 | else | 1947 | else |
1932 | cfq_clear_crq_is_sync(crq); | 1948 | cfq_clear_crq_is_sync(crq); |