Commit 1abec4fdbb142e3ccb6ce99832fae42129134a96
Committed by
Jens Axboe
1 parent
c86d1b8ae6
Exists in
master
and in
7 other branches
block: make blk_init_free_list and elevator_init idempotent
blk_init_allocated_queue_node may fail and the caller _could_ retry. Accommodate the unlikely event that blk_init_allocated_queue_node is called on an already initialized (possibly partially) request_queue. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Showing 2 changed files with 7 additions and 2 deletions Side-by-side Diff
block/blk-core.c
block/elevator.c
... | ... | @@ -242,9 +242,11 @@ |
242 | 242 | { |
243 | 243 | struct elevator_type *e = NULL; |
244 | 244 | struct elevator_queue *eq; |
245 | - int ret = 0; | |
246 | 245 | void *data; |
247 | 246 | |
247 | + if (unlikely(q->elevator)) | |
248 | + return 0; | |
249 | + | |
248 | 250 | INIT_LIST_HEAD(&q->queue_head); |
249 | 251 | q->last_merge = NULL; |
250 | 252 | q->end_sector = 0; |
... | ... | @@ -284,7 +286,7 @@ |
284 | 286 | } |
285 | 287 | |
286 | 288 | elevator_attach(q, eq, data); |
287 | - return ret; | |
289 | + return 0; | |
288 | 290 | } |
289 | 291 | EXPORT_SYMBOL(elevator_init); |
290 | 292 |