aboutsummaryrefslogtreecommitdiffstats
path: root/block/genhd.c
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2007-07-17 07:03:29 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-17 13:23:02 -0400
commit94f6030ca792c57422f04a73e7a872d8325946d3 (patch)
tree0197f24d82b1706f1b0521f2cf68feeff64123df /block/genhd.c
parent81cda6626178cd55297831296ba8ecedbfd8b52d (diff)
Slab allocators: Replace explicit zeroing with __GFP_ZERO
kmalloc_node() and kmem_cache_alloc_node() were not available in a zeroing variant in the past. But with __GFP_ZERO it is possible now to do zeroing while allocating. Use __GFP_ZERO to remove the explicit clearing of memory via memset whereever we can. Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 863a8c0623ed..b321cadd6e65 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -726,21 +726,21 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
726{ 726{
727 struct gendisk *disk; 727 struct gendisk *disk;
728 728
729 disk = kmalloc_node(sizeof(struct gendisk), GFP_KERNEL, node_id); 729 disk = kmalloc_node(sizeof(struct gendisk),
730 GFP_KERNEL | __GFP_ZERO, node_id);
730 if (disk) { 731 if (disk) {
731 memset(disk, 0, sizeof(struct gendisk));
732 if (!init_disk_stats(disk)) { 732 if (!init_disk_stats(disk)) {
733 kfree(disk); 733 kfree(disk);
734 return NULL; 734 return NULL;
735 } 735 }
736 if (minors > 1) { 736 if (minors > 1) {
737 int size = (minors - 1) * sizeof(struct hd_struct *); 737 int size = (minors - 1) * sizeof(struct hd_struct *);
738 disk->part = kmalloc_node(size, GFP_KERNEL, node_id); 738 disk->part = kmalloc_node(size,
739 GFP_KERNEL | __GFP_ZERO, node_id);
739 if (!disk->part) { 740 if (!disk->part) {
740 kfree(disk); 741 kfree(disk);
741 return NULL; 742 return NULL;
742 } 743 }
743 memset(disk->part, 0, size);
744 } 744 }
745 disk->minors = minors; 745 disk->minors = minors;
746 kobj_set_kset_s(disk,block_subsys); 746 kobj_set_kset_s(disk,block_subsys);