aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/ll_rw_blk.c
diff options
context:
space:
mode:
authorChristoph Lameter <christoph@lameter.com>2005-06-23 03:08:19 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-23 12:45:09 -0400
commit1946089a109251655c5438d92c539bd2930e71ea (patch)
tree819a492d5a7c4e6e695b150a86abeb99d5ac46eb /drivers/block/ll_rw_blk.c
parent8c5a09082f4e61a176382e96a831a0636b918602 (diff)
[PATCH] NUMA aware block device control structure allocation
Patch to allocate the control structures for for ide devices on the node of the device itself (for NUMA systems). The patch depends on the Slab API change patch by Manfred and me (in mm) and the pcidev_to_node patch that I posted today. Does some realignment too. Signed-off-by: Justin M. Forbes <jmforbes@linuxtx.org> Signed-off-by: Christoph Lameter <christoph@lameter.com> Signed-off-by: Pravin Shelar <pravin@calsoftinc.com> Signed-off-by: Shobhit Dayal <shobhit@calsoftinc.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/block/ll_rw_blk.c')
-rw-r--r--drivers/block/ll_rw_blk.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
index 81fe3a0c1fe7..cd8cf302068c 100644
--- a/drivers/block/ll_rw_blk.c
+++ b/drivers/block/ll_rw_blk.c
@@ -28,6 +28,7 @@
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/swap.h> 29#include <linux/swap.h>
30#include <linux/writeback.h> 30#include <linux/writeback.h>
31#include <linux/blkdev.h>
31 32
32/* 33/*
33 * for max sense size 34 * for max sense size
@@ -1645,7 +1646,8 @@ static int blk_init_free_list(request_queue_t *q)
1645 init_waitqueue_head(&rl->wait[WRITE]); 1646 init_waitqueue_head(&rl->wait[WRITE]);
1646 init_waitqueue_head(&rl->drain); 1647 init_waitqueue_head(&rl->drain);
1647 1648
1648 rl->rq_pool = mempool_create(BLKDEV_MIN_RQ, mempool_alloc_slab, mempool_free_slab, request_cachep); 1649 rl->rq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab,
1650 mempool_free_slab, request_cachep, q->node);
1649 1651
1650 if (!rl->rq_pool) 1652 if (!rl->rq_pool)
1651 return -ENOMEM; 1653 return -ENOMEM;
@@ -1657,8 +1659,15 @@ static int __make_request(request_queue_t *, struct bio *);
1657 1659
1658request_queue_t *blk_alloc_queue(int gfp_mask) 1660request_queue_t *blk_alloc_queue(int gfp_mask)
1659{ 1661{
1660 request_queue_t *q = kmem_cache_alloc(requestq_cachep, gfp_mask); 1662 return blk_alloc_queue_node(gfp_mask, -1);
1663}
1664EXPORT_SYMBOL(blk_alloc_queue);
1665
1666request_queue_t *blk_alloc_queue_node(int gfp_mask, int node_id)
1667{
1668 request_queue_t *q;
1661 1669
1670 q = kmem_cache_alloc_node(requestq_cachep, gfp_mask, node_id);
1662 if (!q) 1671 if (!q)
1663 return NULL; 1672 return NULL;
1664 1673
@@ -1671,8 +1680,7 @@ request_queue_t *blk_alloc_queue(int gfp_mask)
1671 1680
1672 return q; 1681 return q;
1673} 1682}
1674 1683EXPORT_SYMBOL(blk_alloc_queue_node);
1675EXPORT_SYMBOL(blk_alloc_queue);
1676 1684
1677/** 1685/**
1678 * blk_init_queue - prepare a request queue for use with a block device 1686 * blk_init_queue - prepare a request queue for use with a block device
@@ -1705,13 +1713,22 @@ EXPORT_SYMBOL(blk_alloc_queue);
1705 * blk_init_queue() must be paired with a blk_cleanup_queue() call 1713 * blk_init_queue() must be paired with a blk_cleanup_queue() call
1706 * when the block device is deactivated (such as at module unload). 1714 * when the block device is deactivated (such as at module unload).
1707 **/ 1715 **/
1716
1708request_queue_t *blk_init_queue(request_fn_proc *rfn, spinlock_t *lock) 1717request_queue_t *blk_init_queue(request_fn_proc *rfn, spinlock_t *lock)
1709{ 1718{
1710 request_queue_t *q = blk_alloc_queue(GFP_KERNEL); 1719 return blk_init_queue_node(rfn, lock, -1);
1720}
1721EXPORT_SYMBOL(blk_init_queue);
1722
1723request_queue_t *
1724blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
1725{
1726 request_queue_t *q = blk_alloc_queue_node(GFP_KERNEL, node_id);
1711 1727
1712 if (!q) 1728 if (!q)
1713 return NULL; 1729 return NULL;
1714 1730
1731 q->node = node_id;
1715 if (blk_init_free_list(q)) 1732 if (blk_init_free_list(q))
1716 goto out_init; 1733 goto out_init;
1717 1734
@@ -1754,8 +1771,7 @@ out_init:
1754 kmem_cache_free(requestq_cachep, q); 1771 kmem_cache_free(requestq_cachep, q);
1755 return NULL; 1772 return NULL;
1756} 1773}
1757 1774EXPORT_SYMBOL(blk_init_queue_node);
1758EXPORT_SYMBOL(blk_init_queue);
1759 1775
1760int blk_get_queue(request_queue_t *q) 1776int blk_get_queue(request_queue_t *q)
1761{ 1777{