diff options
Diffstat (limited to 'block/blk-core.c')
| -rw-r--r-- | block/blk-core.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index c00e0bdeab4a..853f92749202 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
| @@ -693,11 +693,20 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id) | |||
| 693 | if (!uninit_q) | 693 | if (!uninit_q) |
| 694 | return NULL; | 694 | return NULL; |
| 695 | 695 | ||
| 696 | uninit_q->flush_rq = kzalloc(sizeof(struct request), GFP_KERNEL); | ||
| 697 | if (!uninit_q->flush_rq) | ||
| 698 | goto out_cleanup_queue; | ||
| 699 | |||
| 696 | q = blk_init_allocated_queue(uninit_q, rfn, lock); | 700 | q = blk_init_allocated_queue(uninit_q, rfn, lock); |
| 697 | if (!q) | 701 | if (!q) |
| 698 | blk_cleanup_queue(uninit_q); | 702 | goto out_free_flush_rq; |
| 699 | |||
| 700 | return q; | 703 | return q; |
| 704 | |||
| 705 | out_free_flush_rq: | ||
| 706 | kfree(uninit_q->flush_rq); | ||
| 707 | out_cleanup_queue: | ||
| 708 | blk_cleanup_queue(uninit_q); | ||
| 709 | return NULL; | ||
| 701 | } | 710 | } |
| 702 | EXPORT_SYMBOL(blk_init_queue_node); | 711 | EXPORT_SYMBOL(blk_init_queue_node); |
| 703 | 712 | ||
| @@ -1127,7 +1136,7 @@ static struct request *blk_old_get_request(struct request_queue *q, int rw, | |||
| 1127 | struct request *blk_get_request(struct request_queue *q, int rw, gfp_t gfp_mask) | 1136 | struct request *blk_get_request(struct request_queue *q, int rw, gfp_t gfp_mask) |
| 1128 | { | 1137 | { |
| 1129 | if (q->mq_ops) | 1138 | if (q->mq_ops) |
| 1130 | return blk_mq_alloc_request(q, rw, gfp_mask, false); | 1139 | return blk_mq_alloc_request(q, rw, gfp_mask); |
| 1131 | else | 1140 | else |
| 1132 | return blk_old_get_request(q, rw, gfp_mask); | 1141 | return blk_old_get_request(q, rw, gfp_mask); |
| 1133 | } | 1142 | } |
| @@ -1278,6 +1287,11 @@ void __blk_put_request(struct request_queue *q, struct request *req) | |||
| 1278 | if (unlikely(!q)) | 1287 | if (unlikely(!q)) |
| 1279 | return; | 1288 | return; |
| 1280 | 1289 | ||
| 1290 | if (q->mq_ops) { | ||
| 1291 | blk_mq_free_request(req); | ||
| 1292 | return; | ||
| 1293 | } | ||
| 1294 | |||
| 1281 | blk_pm_put_request(req); | 1295 | blk_pm_put_request(req); |
| 1282 | 1296 | ||
| 1283 | elv_completed_request(q, req); | 1297 | elv_completed_request(q, req); |
