History

[PATCH] keep sync and async cfq_queue separate

Al Viro committed 20 years ago

Commit 12a05731 parent 478a82b2 files · +27 −11Browse files

Unified · Split

2 files
  1. block/cfq-iosched.c +26 −10
  2. include/linux/blkdev.h +1 −1
block/cfq-iosched.c+26−10
@@ -1219,11 +1219,20 @@ static void cfq_exit_single_io_context(struct cfq_io_context *cic) · 1218 unmodified lines
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) · 29 unmodified lines
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) · 59 unmodified lines
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, · 560 unmodified lines
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, · 4 unmodified lines
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 } else1927 } 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, · 10 unmodified lines
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 else1947 else
1932 cfq_clear_crq_is_sync(crq);1948 cfq_clear_crq_is_sync(crq);
include/linux/blkdev.h+1−1
@@ -58,7 +58,7 @@ struct cfq_io_context { · 57 unmodified lines
58 * circular list of cfq_io_contexts belonging to a process io context58 * circular list of cfq_io_contexts belonging to a process io context
59 */59 */
60 struct list_head list;60 struct list_head list;
61 struct cfq_queue *cfqq;61 struct cfq_queue *cfqq[2];
62 void *key;62 void *key;
63 63
64 struct io_context *ioc;64 struct io_context *ioc;