aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
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
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')
-rw-r--r--drivers/block/as-iosched.c8
-rw-r--r--drivers/block/deadline-iosched.c8
-rw-r--r--drivers/block/genhd.c13
-rw-r--r--drivers/block/ll_rw_blk.c30
4 files changed, 43 insertions, 16 deletions
diff --git a/drivers/block/as-iosched.c b/drivers/block/as-iosched.c
index 638db06de2be..3410b4d294b9 100644
--- a/drivers/block/as-iosched.c
+++ b/drivers/block/as-iosched.c
@@ -1871,20 +1871,22 @@ static int as_init_queue(request_queue_t *q, elevator_t *e)
1871 if (!arq_pool) 1871 if (!arq_pool)
1872 return -ENOMEM; 1872 return -ENOMEM;
1873 1873
1874 ad = kmalloc(sizeof(*ad), GFP_KERNEL); 1874 ad = kmalloc_node(sizeof(*ad), GFP_KERNEL, q->node);
1875 if (!ad) 1875 if (!ad)
1876 return -ENOMEM; 1876 return -ENOMEM;
1877 memset(ad, 0, sizeof(*ad)); 1877 memset(ad, 0, sizeof(*ad));
1878 1878
1879 ad->q = q; /* Identify what queue the data belongs to */ 1879 ad->q = q; /* Identify what queue the data belongs to */
1880 1880
1881 ad->hash = kmalloc(sizeof(struct list_head)*AS_HASH_ENTRIES,GFP_KERNEL); 1881 ad->hash = kmalloc_node(sizeof(struct list_head)*AS_HASH_ENTRIES,
1882 GFP_KERNEL, q->node);
1882 if (!ad->hash) { 1883 if (!ad->hash) {
1883 kfree(ad); 1884 kfree(ad);
1884 return -ENOMEM; 1885 return -ENOMEM;
1885 } 1886 }
1886 1887
1887 ad->arq_pool = mempool_create(BLKDEV_MIN_RQ, mempool_alloc_slab, mempool_free_slab, arq_pool); 1888 ad->arq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab,
1889 mempool_free_slab, arq_pool, q->node);
1888 if (!ad->arq_pool) { 1890 if (!ad->arq_pool) {
1889 kfree(ad->hash); 1891 kfree(ad->hash);
1890 kfree(ad); 1892 kfree(ad);
diff --git a/drivers/block/deadline-iosched.c b/drivers/block/deadline-iosched.c
index 7f79f3dd0165..4bc2fea73273 100644
--- a/drivers/block/deadline-iosched.c
+++ b/drivers/block/deadline-iosched.c
@@ -711,18 +711,20 @@ static int deadline_init_queue(request_queue_t *q, elevator_t *e)
711 if (!drq_pool) 711 if (!drq_pool)
712 return -ENOMEM; 712 return -ENOMEM;
713 713
714 dd = kmalloc(sizeof(*dd), GFP_KERNEL); 714 dd = kmalloc_node(sizeof(*dd), GFP_KERNEL, q->node);
715 if (!dd) 715 if (!dd)
716 return -ENOMEM; 716 return -ENOMEM;
717 memset(dd, 0, sizeof(*dd)); 717 memset(dd, 0, sizeof(*dd));
718 718
719 dd->hash = kmalloc(sizeof(struct list_head)*DL_HASH_ENTRIES,GFP_KERNEL); 719 dd->hash = kmalloc_node(sizeof(struct list_head)*DL_HASH_ENTRIES,
720 GFP_KERNEL, q->node);
720 if (!dd->hash) { 721 if (!dd->hash) {
721 kfree(dd); 722 kfree(dd);
722 return -ENOMEM; 723 return -ENOMEM;
723 } 724 }
724 725
725 dd->drq_pool = mempool_create(BLKDEV_MIN_RQ, mempool_alloc_slab, mempool_free_slab, drq_pool); 726 dd->drq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab,
727 mempool_free_slab, drq_pool, q->node);
726 if (!dd->drq_pool) { 728 if (!dd->drq_pool) {
727 kfree(dd->hash); 729 kfree(dd->hash);
728 kfree(dd); 730 kfree(dd);
diff --git a/drivers/block/genhd.c b/drivers/block/genhd.c
index 53f7d846b747..43805e4d31e9 100644
--- a/drivers/block/genhd.c
+++ b/drivers/block/genhd.c
@@ -582,10 +582,16 @@ struct seq_operations diskstats_op = {
582 .show = diskstats_show 582 .show = diskstats_show
583}; 583};
584 584
585
586struct gendisk *alloc_disk(int minors) 585struct gendisk *alloc_disk(int minors)
587{ 586{
588 struct gendisk *disk = kmalloc(sizeof(struct gendisk), GFP_KERNEL); 587 return alloc_disk_node(minors, -1);
588}
589
590struct gendisk *alloc_disk_node(int minors, int node_id)
591{
592 struct gendisk *disk;
593
594 disk = kmalloc_node(sizeof(struct gendisk), GFP_KERNEL, node_id);
589 if (disk) { 595 if (disk) {
590 memset(disk, 0, sizeof(struct gendisk)); 596 memset(disk, 0, sizeof(struct gendisk));
591 if (!init_disk_stats(disk)) { 597 if (!init_disk_stats(disk)) {
@@ -594,7 +600,7 @@ struct gendisk *alloc_disk(int minors)
594 } 600 }
595 if (minors > 1) { 601 if (minors > 1) {
596 int size = (minors - 1) * sizeof(struct hd_struct *); 602 int size = (minors - 1) * sizeof(struct hd_struct *);
597 disk->part = kmalloc(size, GFP_KERNEL); 603 disk->part = kmalloc_node(size, GFP_KERNEL, node_id);
598 if (!disk->part) { 604 if (!disk->part) {
599 kfree(disk); 605 kfree(disk);
600 return NULL; 606 return NULL;
@@ -610,6 +616,7 @@ struct gendisk *alloc_disk(int minors)
610} 616}
611 617
612EXPORT_SYMBOL(alloc_disk); 618EXPORT_SYMBOL(alloc_disk);
619EXPORT_SYMBOL(alloc_disk_node);
613 620
614struct kobject *get_disk(struct gendisk *disk) 621struct kobject *get_disk(struct gendisk *disk)
615{ 622{
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{