Skip to contentSkip to conversation

udf: use simple_malloc()/simple_free()

PATCH In review Lai Jiangshan 1 participant 1 message Nov 16, 2008 UDF filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 6/7 udf: use simple_malloc()/simple_free()

use simple_malloc()/simple_free() instead of current codes.

---

fs/udf/super.c +2 -10
index e25e701..165ca64 100644
@@ -1069,10 +1069,7 @@ static struct udf_bitmap *udf_sb_alloc_bitmap(struct super_block *sb, u32 index)
 	size = sizeof(struct udf_bitmap) +
 		(sizeof(struct buffer_head *) * nr_groups);
 
-	if (size <= PAGE_SIZE)
-		bitmap = kmalloc(size, GFP_KERNEL);
-	else
-		bitmap = vmalloc(size); /* TODO: get rid of vmalloc */
+	bitmap = simple_malloc(size);
 
 	if (bitmap == NULL) {
 		udf_error(sb, __func__,
@@ -1801,17 +1798,12 @@ static void udf_sb_free_bitmap(struct udf_bitmap *bitmap)
 {
 	int i;
 	int nr_groups = bitmap->s_nr_groups;
-	int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) *
-						nr_groups);
 
 	for (i = 0; i < nr_groups; i++)
 		if (bitmap->s_block_bitmap[i])
 			brelse(bitmap->s_block_bitmap[i]);
 
-	if (size <= PAGE_SIZE)
-		kfree(bitmap);
-	else
-		vfree(bitmap);
+	simple_free(bitmap);
 }
 
 static void udf_free_partition(struct udf_part_map *map)