Commit fc1be578 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] blk_init() cleanups

From Christoph Hellwig, acked by Jens.

- remove some unneeded runtime initializers.

- remove the explicit call to hd_init() - it already goes through
module_init(), so we're currently running hd_init() twice.
parent a7d2851c
...@@ -53,7 +53,7 @@ static kmem_cache_t *request_cachep; ...@@ -53,7 +53,7 @@ static kmem_cache_t *request_cachep;
/* /*
* plug management * plug management
*/ */
static struct list_head blk_plug_list; static LIST_HEAD(blk_plug_list);
static spinlock_t blk_plug_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED; static spinlock_t blk_plug_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
/* blk_dev_struct is: /* blk_dev_struct is:
...@@ -2041,27 +2041,16 @@ void end_that_request_last(struct request *req) ...@@ -2041,27 +2041,16 @@ void end_that_request_last(struct request *req)
blk_put_request(req); blk_put_request(req);
} }
#define MB(kb) ((kb) << 10)
int __init blk_dev_init(void) int __init blk_dev_init(void)
{ {
struct blk_dev_struct *dev; int total_ram = nr_free_pages() << (PAGE_SHIFT - 10);
int total_ram;
request_cachep = kmem_cache_create("blkdev_requests", request_cachep = kmem_cache_create("blkdev_requests",
sizeof(struct request), sizeof(struct request), 0,
0, SLAB_HWCACHE_ALIGN, NULL, NULL); SLAB_HWCACHE_ALIGN, NULL, NULL);
if (!request_cachep) if (!request_cachep)
panic("Can't create request pool slab cache\n"); panic("Can't create request pool slab cache\n");
for (dev = blk_dev + MAX_BLKDEV; dev-- != blk_dev;)
dev->queue = NULL;
memset(ro_bits,0,sizeof(ro_bits));
total_ram = nr_free_pages() << (PAGE_SHIFT - 10);
/* /*
* Free request slots per queue. * Free request slots per queue.
* (Half for reads, half for writes) * (Half for reads, half for writes)
...@@ -2077,17 +2066,12 @@ int __init blk_dev_init(void) ...@@ -2077,17 +2066,12 @@ int __init blk_dev_init(void)
*/ */
if ((batch_requests = queue_nr_requests / 4) > 32) if ((batch_requests = queue_nr_requests / 4) > 32)
batch_requests = 32; batch_requests = 32;
printk("block: %d slots per queue, batch=%d\n", queue_nr_requests, batch_requests); printk("block: %d slots per queue, batch=%d\n",
queue_nr_requests, batch_requests);
blk_max_low_pfn = max_low_pfn; blk_max_low_pfn = max_low_pfn;
blk_max_pfn = max_pfn; blk_max_pfn = max_pfn;
INIT_LIST_HEAD(&blk_plug_list);
#if defined(CONFIG_IDE) && defined(CONFIG_BLK_DEV_HD)
hd_init();
#endif
return 0; return 0;
}; };
......
...@@ -846,7 +846,7 @@ static void __init hd_geninit(void) ...@@ -846,7 +846,7 @@ static void __init hd_geninit(void)
} }
} }
int __init hd_init(void) static int __init hd_init(void)
{ {
if (register_blkdev(MAJOR_NR,"hd",&hd_fops)) { if (register_blkdev(MAJOR_NR,"hd",&hd_fops)) {
printk("hd: unable to get major %d for hard disk\n",MAJOR_NR); printk("hd: unable to get major %d for hard disk\n",MAJOR_NR);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment