diff options
| -rw-r--r-- | block/blk-core.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 794c3e7f01cf..fd154b94447a 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
| @@ -557,6 +557,18 @@ void blk_cleanup_queue(struct request_queue *q) | |||
| 557 | } | 557 | } |
| 558 | EXPORT_SYMBOL(blk_cleanup_queue); | 558 | EXPORT_SYMBOL(blk_cleanup_queue); |
| 559 | 559 | ||
| 560 | /* Allocate memory local to the request queue */ | ||
| 561 | static void *alloc_request_struct(gfp_t gfp_mask, void *data) | ||
| 562 | { | ||
| 563 | int nid = (int)(long)data; | ||
| 564 | return kmem_cache_alloc_node(request_cachep, gfp_mask, nid); | ||
| 565 | } | ||
| 566 | |||
| 567 | static void free_request_struct(void *element, void *unused) | ||
| 568 | { | ||
| 569 | kmem_cache_free(request_cachep, element); | ||
| 570 | } | ||
| 571 | |||
| 560 | int blk_init_rl(struct request_list *rl, struct request_queue *q, | 572 | int blk_init_rl(struct request_list *rl, struct request_queue *q, |
| 561 | gfp_t gfp_mask) | 573 | gfp_t gfp_mask) |
| 562 | { | 574 | { |
| @@ -569,9 +581,10 @@ int blk_init_rl(struct request_list *rl, struct request_queue *q, | |||
| 569 | init_waitqueue_head(&rl->wait[BLK_RW_SYNC]); | 581 | init_waitqueue_head(&rl->wait[BLK_RW_SYNC]); |
| 570 | init_waitqueue_head(&rl->wait[BLK_RW_ASYNC]); | 582 | init_waitqueue_head(&rl->wait[BLK_RW_ASYNC]); |
| 571 | 583 | ||
| 572 | rl->rq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab, | 584 | rl->rq_pool = mempool_create_node(BLKDEV_MIN_RQ, alloc_request_struct, |
| 573 | mempool_free_slab, request_cachep, | 585 | free_request_struct, |
| 574 | gfp_mask, q->node); | 586 | (void *)(long)q->node, gfp_mask, |
| 587 | q->node); | ||
| 575 | if (!rl->rq_pool) | 588 | if (!rl->rq_pool) |
| 576 | return -ENOMEM; | 589 | return -ENOMEM; |
| 577 | 590 | ||
