diff options
-rw-r--r-- | block/as-iosched.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/block/as-iosched.c b/block/as-iosched.c index 134545b544c5..c2665467950e 100644 --- a/block/as-iosched.c +++ b/block/as-iosched.c | |||
@@ -131,8 +131,6 @@ struct as_data { | |||
131 | unsigned long antic_expire; | 131 | unsigned long antic_expire; |
132 | }; | 132 | }; |
133 | 133 | ||
134 | #define list_entry_fifo(ptr) list_entry((ptr), struct as_rq, fifo) | ||
135 | |||
136 | /* | 134 | /* |
137 | * per-request data. | 135 | * per-request data. |
138 | */ | 136 | */ |
@@ -153,12 +151,6 @@ struct as_rq { | |||
153 | 151 | ||
154 | struct io_context *io_context; /* The submitting task */ | 152 | struct io_context *io_context; /* The submitting task */ |
155 | 153 | ||
156 | /* | ||
157 | * expire fifo | ||
158 | */ | ||
159 | struct list_head fifo; | ||
160 | unsigned long expires; | ||
161 | |||
162 | unsigned int is_sync; | 154 | unsigned int is_sync; |
163 | enum arq_state state; | 155 | enum arq_state state; |
164 | }; | 156 | }; |
@@ -893,7 +885,7 @@ static void as_remove_queued_request(request_queue_t *q, struct request *rq) | |||
893 | if (ad->next_arq[data_dir] == arq) | 885 | if (ad->next_arq[data_dir] == arq) |
894 | ad->next_arq[data_dir] = as_find_next_arq(ad, arq); | 886 | ad->next_arq[data_dir] = as_find_next_arq(ad, arq); |
895 | 887 | ||
896 | list_del_init(&arq->fifo); | 888 | rq_fifo_clear(rq); |
897 | as_del_arq_rb(ad, rq); | 889 | as_del_arq_rb(ad, rq); |
898 | } | 890 | } |
899 | 891 | ||
@@ -907,7 +899,7 @@ static void as_remove_queued_request(request_queue_t *q, struct request *rq) | |||
907 | */ | 899 | */ |
908 | static int as_fifo_expired(struct as_data *ad, int adir) | 900 | static int as_fifo_expired(struct as_data *ad, int adir) |
909 | { | 901 | { |
910 | struct as_rq *arq; | 902 | struct request *rq; |
911 | long delta_jif; | 903 | long delta_jif; |
912 | 904 | ||
913 | delta_jif = jiffies - ad->last_check_fifo[adir]; | 905 | delta_jif = jiffies - ad->last_check_fifo[adir]; |
@@ -921,9 +913,9 @@ static int as_fifo_expired(struct as_data *ad, int adir) | |||
921 | if (list_empty(&ad->fifo_list[adir])) | 913 | if (list_empty(&ad->fifo_list[adir])) |
922 | return 0; | 914 | return 0; |
923 | 915 | ||
924 | arq = list_entry_fifo(ad->fifo_list[adir].next); | 916 | rq = rq_entry_fifo(ad->fifo_list[adir].next); |
925 | 917 | ||
926 | return time_after(jiffies, arq->expires); | 918 | return time_after(jiffies, rq_fifo_time(rq)); |
927 | } | 919 | } |
928 | 920 | ||
929 | /* | 921 | /* |
@@ -1089,7 +1081,7 @@ static int as_dispatch_request(request_queue_t *q, int force) | |||
1089 | ad->changed_batch = 1; | 1081 | ad->changed_batch = 1; |
1090 | } | 1082 | } |
1091 | ad->batch_data_dir = REQ_SYNC; | 1083 | ad->batch_data_dir = REQ_SYNC; |
1092 | arq = list_entry_fifo(ad->fifo_list[ad->batch_data_dir].next); | 1084 | arq = RQ_DATA(rq_entry_fifo(ad->fifo_list[REQ_SYNC].next)); |
1093 | ad->last_check_fifo[ad->batch_data_dir] = jiffies; | 1085 | ad->last_check_fifo[ad->batch_data_dir] = jiffies; |
1094 | goto dispatch_request; | 1086 | goto dispatch_request; |
1095 | } | 1087 | } |
@@ -1129,8 +1121,7 @@ dispatch_request: | |||
1129 | 1121 | ||
1130 | if (as_fifo_expired(ad, ad->batch_data_dir)) { | 1122 | if (as_fifo_expired(ad, ad->batch_data_dir)) { |
1131 | fifo_expired: | 1123 | fifo_expired: |
1132 | arq = list_entry_fifo(ad->fifo_list[ad->batch_data_dir].next); | 1124 | arq = RQ_DATA(rq_entry_fifo(ad->fifo_list[ad->batch_data_dir].next)); |
1133 | BUG_ON(arq == NULL); | ||
1134 | } | 1125 | } |
1135 | 1126 | ||
1136 | if (ad->changed_batch) { | 1127 | if (ad->changed_batch) { |
@@ -1186,8 +1177,8 @@ static void as_add_request(request_queue_t *q, struct request *rq) | |||
1186 | /* | 1177 | /* |
1187 | * set expire time (only used for reads) and add to fifo list | 1178 | * set expire time (only used for reads) and add to fifo list |
1188 | */ | 1179 | */ |
1189 | arq->expires = jiffies + ad->fifo_expire[data_dir]; | 1180 | rq_set_fifo_time(rq, jiffies + ad->fifo_expire[data_dir]); |
1190 | list_add_tail(&arq->fifo, &ad->fifo_list[data_dir]); | 1181 | list_add_tail(&rq->queuelist, &ad->fifo_list[data_dir]); |
1191 | 1182 | ||
1192 | as_update_arq(ad, arq); /* keep state machine up to date */ | 1183 | as_update_arq(ad, arq); /* keep state machine up to date */ |
1193 | arq->state = AS_RQ_QUEUED; | 1184 | arq->state = AS_RQ_QUEUED; |
@@ -1277,10 +1268,10 @@ static void as_merged_requests(request_queue_t *q, struct request *req, | |||
1277 | * if anext expires before arq, assign its expire time to arq | 1268 | * if anext expires before arq, assign its expire time to arq |
1278 | * and move into anext position (anext will be deleted) in fifo | 1269 | * and move into anext position (anext will be deleted) in fifo |
1279 | */ | 1270 | */ |
1280 | if (!list_empty(&arq->fifo) && !list_empty(&anext->fifo)) { | 1271 | if (!list_empty(&req->queuelist) && !list_empty(&next->queuelist)) { |
1281 | if (time_before(anext->expires, arq->expires)) { | 1272 | if (time_before(rq_fifo_time(next), rq_fifo_time(req))) { |
1282 | list_move(&arq->fifo, &anext->fifo); | 1273 | list_move(&req->queuelist, &next->queuelist); |
1283 | arq->expires = anext->expires; | 1274 | rq_set_fifo_time(req, rq_fifo_time(next)); |
1284 | /* | 1275 | /* |
1285 | * Don't copy here but swap, because when anext is | 1276 | * Don't copy here but swap, because when anext is |
1286 | * removed below, it must contain the unused context | 1277 | * removed below, it must contain the unused context |
@@ -1350,7 +1341,6 @@ static int as_set_request(request_queue_t *q, struct request *rq, | |||
1350 | arq->request = rq; | 1341 | arq->request = rq; |
1351 | arq->state = AS_RQ_PRESCHED; | 1342 | arq->state = AS_RQ_PRESCHED; |
1352 | arq->io_context = NULL; | 1343 | arq->io_context = NULL; |
1353 | INIT_LIST_HEAD(&arq->fifo); | ||
1354 | rq->elevator_private = arq; | 1344 | rq->elevator_private = arq; |
1355 | return 0; | 1345 | return 0; |
1356 | } | 1346 | } |