aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/as-iosched.c3
-rw-r--r--block/cfq-iosched.c18
-rw-r--r--block/deadline-iosched.c3
-rw-r--r--block/elevator.c3
-rw-r--r--block/genhd.c20
-rw-r--r--block/ll_rw_blk.c4
6 files changed, 22 insertions, 29 deletions
diff --git a/block/as-iosched.c b/block/as-iosched.c
index 109e91b91ffa..3e316dd72529 100644
--- a/block/as-iosched.c
+++ b/block/as-iosched.c
@@ -1322,10 +1322,9 @@ static void *as_init_queue(request_queue_t *q)
1322{ 1322{
1323 struct as_data *ad; 1323 struct as_data *ad;
1324 1324
1325 ad = kmalloc_node(sizeof(*ad), GFP_KERNEL, q->node); 1325 ad = kmalloc_node(sizeof(*ad), GFP_KERNEL | __GFP_ZERO, q->node);
1326 if (!ad) 1326 if (!ad)
1327 return NULL; 1327 return NULL;
1328 memset(ad, 0, sizeof(*ad));
1329 1328
1330 ad->q = q; /* Identify what queue the data belongs to */ 1329 ad->q = q; /* Identify what queue the data belongs to */
1331 1330
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index e0aa4dad6742..9755a3cfad26 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1251,9 +1251,9 @@ cfq_alloc_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
1251{ 1251{
1252 struct cfq_io_context *cic; 1252 struct cfq_io_context *cic;
1253 1253
1254 cic = kmem_cache_alloc_node(cfq_ioc_pool, gfp_mask, cfqd->queue->node); 1254 cic = kmem_cache_alloc_node(cfq_ioc_pool, gfp_mask | __GFP_ZERO,
1255 cfqd->queue->node);
1255 if (cic) { 1256 if (cic) {
1256 memset(cic, 0, sizeof(*cic));
1257 cic->last_end_request = jiffies; 1257 cic->last_end_request = jiffies;
1258 INIT_LIST_HEAD(&cic->queue_list); 1258 INIT_LIST_HEAD(&cic->queue_list);
1259 cic->dtor = cfq_free_io_context; 1259 cic->dtor = cfq_free_io_context;
@@ -1376,17 +1376,19 @@ retry:
1376 * free memory. 1376 * free memory.
1377 */ 1377 */
1378 spin_unlock_irq(cfqd->queue->queue_lock); 1378 spin_unlock_irq(cfqd->queue->queue_lock);
1379 new_cfqq = kmem_cache_alloc_node(cfq_pool, gfp_mask|__GFP_NOFAIL, cfqd->queue->node); 1379 new_cfqq = kmem_cache_alloc_node(cfq_pool,
1380 gfp_mask | __GFP_NOFAIL | __GFP_ZERO,
1381 cfqd->queue->node);
1380 spin_lock_irq(cfqd->queue->queue_lock); 1382 spin_lock_irq(cfqd->queue->queue_lock);
1381 goto retry; 1383 goto retry;
1382 } else { 1384 } else {
1383 cfqq = kmem_cache_alloc_node(cfq_pool, gfp_mask, cfqd->queue->node); 1385 cfqq = kmem_cache_alloc_node(cfq_pool,
1386 gfp_mask | __GFP_ZERO,
1387 cfqd->queue->node);
1384 if (!cfqq) 1388 if (!cfqq)
1385 goto out; 1389 goto out;
1386 } 1390 }
1387 1391
1388 memset(cfqq, 0, sizeof(*cfqq));
1389
1390 RB_CLEAR_NODE(&cfqq->rb_node); 1392 RB_CLEAR_NODE(&cfqq->rb_node);
1391 INIT_LIST_HEAD(&cfqq->fifo); 1393 INIT_LIST_HEAD(&cfqq->fifo);
1392 1394
@@ -2079,12 +2081,10 @@ static void *cfq_init_queue(request_queue_t *q)
2079{ 2081{
2080 struct cfq_data *cfqd; 2082 struct cfq_data *cfqd;
2081 2083
2082 cfqd = kmalloc_node(sizeof(*cfqd), GFP_KERNEL, q->node); 2084 cfqd = kmalloc_node(sizeof(*cfqd), GFP_KERNEL | __GFP_ZERO, q->node);
2083 if (!cfqd) 2085 if (!cfqd)
2084 return NULL; 2086 return NULL;
2085 2087
2086 memset(cfqd, 0, sizeof(*cfqd));
2087
2088 cfqd->service_tree = CFQ_RB_ROOT; 2088 cfqd->service_tree = CFQ_RB_ROOT;
2089 INIT_LIST_HEAD(&cfqd->cic_list); 2089 INIT_LIST_HEAD(&cfqd->cic_list);
2090 2090
diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c
index 6d673e938d3e..87ca02ac84cb 100644
--- a/block/deadline-iosched.c
+++ b/block/deadline-iosched.c
@@ -360,10 +360,9 @@ static void *deadline_init_queue(request_queue_t *q)
360{ 360{
361 struct deadline_data *dd; 361 struct deadline_data *dd;
362 362
363 dd = kmalloc_node(sizeof(*dd), GFP_KERNEL, q->node); 363 dd = kmalloc_node(sizeof(*dd), GFP_KERNEL | __GFP_ZERO, q->node);
364 if (!dd) 364 if (!dd)
365 return NULL; 365 return NULL;
366 memset(dd, 0, sizeof(*dd));
367 366
368 INIT_LIST_HEAD(&dd->fifo_list[READ]); 367 INIT_LIST_HEAD(&dd->fifo_list[READ]);
369 INIT_LIST_HEAD(&dd->fifo_list[WRITE]); 368 INIT_LIST_HEAD(&dd->fifo_list[WRITE]);
diff --git a/block/elevator.c b/block/elevator.c
index 4769a25d7037..d265963d1ed3 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -177,11 +177,10 @@ static elevator_t *elevator_alloc(request_queue_t *q, struct elevator_type *e)
177 elevator_t *eq; 177 elevator_t *eq;
178 int i; 178 int i;
179 179
180 eq = kmalloc_node(sizeof(elevator_t), GFP_KERNEL, q->node); 180 eq = kmalloc_node(sizeof(elevator_t), GFP_KERNEL | __GFP_ZERO, q->node);
181 if (unlikely(!eq)) 181 if (unlikely(!eq))
182 goto err; 182 goto err;
183 183
184 memset(eq, 0, sizeof(*eq));
185 eq->ops = &e->ops; 184 eq->ops = &e->ops;
186 eq->elevator_type = e; 185 eq->elevator_type = e;
187 kobject_init(&eq->kobj); 186 kobject_init(&eq->kobj);
diff --git a/block/genhd.c b/block/genhd.c
index 863a8c0623ed..3af1e7a378d4 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -108,28 +108,24 @@ out:
108 108
109EXPORT_SYMBOL(register_blkdev); 109EXPORT_SYMBOL(register_blkdev);
110 110
111/* todo: make void - error printk here */ 111void unregister_blkdev(unsigned int major, const char *name)
112int unregister_blkdev(unsigned int major, const char *name)
113{ 112{
114 struct blk_major_name **n; 113 struct blk_major_name **n;
115 struct blk_major_name *p = NULL; 114 struct blk_major_name *p = NULL;
116 int index = major_to_index(major); 115 int index = major_to_index(major);
117 int ret = 0;
118 116
119 mutex_lock(&block_subsys_lock); 117 mutex_lock(&block_subsys_lock);
120 for (n = &major_names[index]; *n; n = &(*n)->next) 118 for (n = &major_names[index]; *n; n = &(*n)->next)
121 if ((*n)->major == major) 119 if ((*n)->major == major)
122 break; 120 break;
123 if (!*n || strcmp((*n)->name, name)) 121 if (!*n || strcmp((*n)->name, name)) {
124 ret = -EINVAL; 122 WARN_ON(1);
125 else { 123 } else {
126 p = *n; 124 p = *n;
127 *n = p->next; 125 *n = p->next;
128 } 126 }
129 mutex_unlock(&block_subsys_lock); 127 mutex_unlock(&block_subsys_lock);
130 kfree(p); 128 kfree(p);
131
132 return ret;
133} 129}
134 130
135EXPORT_SYMBOL(unregister_blkdev); 131EXPORT_SYMBOL(unregister_blkdev);
@@ -726,21 +722,21 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
726{ 722{
727 struct gendisk *disk; 723 struct gendisk *disk;
728 724
729 disk = kmalloc_node(sizeof(struct gendisk), GFP_KERNEL, node_id); 725 disk = kmalloc_node(sizeof(struct gendisk),
726 GFP_KERNEL | __GFP_ZERO, node_id);
730 if (disk) { 727 if (disk) {
731 memset(disk, 0, sizeof(struct gendisk));
732 if (!init_disk_stats(disk)) { 728 if (!init_disk_stats(disk)) {
733 kfree(disk); 729 kfree(disk);
734 return NULL; 730 return NULL;
735 } 731 }
736 if (minors > 1) { 732 if (minors > 1) {
737 int size = (minors - 1) * sizeof(struct hd_struct *); 733 int size = (minors - 1) * sizeof(struct hd_struct *);
738 disk->part = kmalloc_node(size, GFP_KERNEL, node_id); 734 disk->part = kmalloc_node(size,
735 GFP_KERNEL | __GFP_ZERO, node_id);
739 if (!disk->part) { 736 if (!disk->part) {
740 kfree(disk); 737 kfree(disk);
741 return NULL; 738 return NULL;
742 } 739 }
743 memset(disk->part, 0, size);
744 } 740 }
745 disk->minors = minors; 741 disk->minors = minors;
746 kobj_set_kset_s(disk,block_subsys); 742 kobj_set_kset_s(disk,block_subsys);
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 11e4235d0b0c..d7cadf304168 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -1829,11 +1829,11 @@ request_queue_t *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
1829{ 1829{
1830 request_queue_t *q; 1830 request_queue_t *q;
1831 1831
1832 q = kmem_cache_alloc_node(requestq_cachep, gfp_mask, node_id); 1832 q = kmem_cache_alloc_node(requestq_cachep,
1833 gfp_mask | __GFP_ZERO, node_id);
1833 if (!q) 1834 if (!q)
1834 return NULL; 1835 return NULL;
1835 1836
1836 memset(q, 0, sizeof(*q));
1837 init_timer(&q->unplug_timer); 1837 init_timer(&q->unplug_timer);
1838 1838
1839 snprintf(q->kobj.name, KOBJ_NAME_LEN, "%s", "queue"); 1839 snprintf(q->kobj.name, KOBJ_NAME_LEN, "%s", "queue");