diff options
Diffstat (limited to 'block/as-iosched.c')
| -rw-r--r-- | block/as-iosched.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/block/as-iosched.c b/block/as-iosched.c index 96036846a001..8c3946787dbb 100644 --- a/block/as-iosched.c +++ b/block/as-iosched.c | |||
| @@ -170,11 +170,11 @@ static void free_as_io_context(struct as_io_context *aic) | |||
| 170 | 170 | ||
| 171 | static void as_trim(struct io_context *ioc) | 171 | static void as_trim(struct io_context *ioc) |
| 172 | { | 172 | { |
| 173 | spin_lock(&ioc->lock); | 173 | spin_lock_irq(&ioc->lock); |
| 174 | if (ioc->aic) | 174 | if (ioc->aic) |
| 175 | free_as_io_context(ioc->aic); | 175 | free_as_io_context(ioc->aic); |
| 176 | ioc->aic = NULL; | 176 | ioc->aic = NULL; |
| 177 | spin_unlock(&ioc->lock); | 177 | spin_unlock_irq(&ioc->lock); |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | /* Called when the task exits */ | 180 | /* Called when the task exits */ |
| @@ -235,10 +235,12 @@ static void as_put_io_context(struct request *rq) | |||
| 235 | aic = RQ_IOC(rq)->aic; | 235 | aic = RQ_IOC(rq)->aic; |
| 236 | 236 | ||
| 237 | if (rq_is_sync(rq) && aic) { | 237 | if (rq_is_sync(rq) && aic) { |
| 238 | spin_lock(&aic->lock); | 238 | unsigned long flags; |
| 239 | |||
| 240 | spin_lock_irqsave(&aic->lock, flags); | ||
| 239 | set_bit(AS_TASK_IORUNNING, &aic->state); | 241 | set_bit(AS_TASK_IORUNNING, &aic->state); |
| 240 | aic->last_end_request = jiffies; | 242 | aic->last_end_request = jiffies; |
| 241 | spin_unlock(&aic->lock); | 243 | spin_unlock_irqrestore(&aic->lock, flags); |
| 242 | } | 244 | } |
| 243 | 245 | ||
| 244 | put_io_context(RQ_IOC(rq)); | 246 | put_io_context(RQ_IOC(rq)); |
| @@ -1266,22 +1268,8 @@ static void as_merged_requests(struct request_queue *q, struct request *req, | |||
| 1266 | */ | 1268 | */ |
| 1267 | if (!list_empty(&req->queuelist) && !list_empty(&next->queuelist)) { | 1269 | if (!list_empty(&req->queuelist) && !list_empty(&next->queuelist)) { |
| 1268 | if (time_before(rq_fifo_time(next), rq_fifo_time(req))) { | 1270 | if (time_before(rq_fifo_time(next), rq_fifo_time(req))) { |
| 1269 | struct io_context *rioc = RQ_IOC(req); | ||
| 1270 | struct io_context *nioc = RQ_IOC(next); | ||
| 1271 | |||
| 1272 | list_move(&req->queuelist, &next->queuelist); | 1271 | list_move(&req->queuelist, &next->queuelist); |
| 1273 | rq_set_fifo_time(req, rq_fifo_time(next)); | 1272 | rq_set_fifo_time(req, rq_fifo_time(next)); |
| 1274 | /* | ||
| 1275 | * Don't copy here but swap, because when anext is | ||
| 1276 | * removed below, it must contain the unused context | ||
| 1277 | */ | ||
| 1278 | if (rioc != nioc) { | ||
| 1279 | double_spin_lock(&rioc->lock, &nioc->lock, | ||
| 1280 | rioc < nioc); | ||
| 1281 | swap_io_context(&rioc, &nioc); | ||
| 1282 | double_spin_unlock(&rioc->lock, &nioc->lock, | ||
| 1283 | rioc < nioc); | ||
| 1284 | } | ||
| 1285 | } | 1273 | } |
| 1286 | } | 1274 | } |
| 1287 | 1275 | ||
