Skip to contentSkip to conversation

ext3: Use DIV_ROUND_UP() on group desc block counting

PATCH In review Namhyung Kim 2 participants 2 messages Oct 11, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext3: Use DIV_ROUND_UP() on group desc block counting

---
 fs/ext3/super.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
fs/ext3/super.c +1 -2
index 75bbf77..3fce402 100644
@@ -1864,8 +1864,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
 	sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) -
 			       le32_to_cpu(es->s_first_data_block) - 1)
 				       / EXT3_BLOCKS_PER_GROUP(sb)) + 1;
-	db_count = (sbi->s_groups_count + EXT3_DESC_PER_BLOCK(sb) - 1) /
-		   EXT3_DESC_PER_BLOCK(sb);
+	db_count = DIV_ROUND_UP(sbi->s_groups_count, EXT3_DESC_PER_BLOCK(sb));
 	sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *),
 				    GFP_KERNEL);
 	if (sbi->s_group_desc == NULL) {
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 1 line · Namhyung Kim

OK. Merged.

Honza

Quoted 21 lines
---
 fs/ext3/super.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
fs/ext3/super.c +1 -2
index 75bbf77..3fce402 100644
@@ -1864,8 +1864,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
 	sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) -
 			       le32_to_cpu(es->s_first_data_block) - 1)
 				       / EXT3_BLOCKS_PER_GROUP(sb)) + 1;
-	db_count = (sbi->s_groups_count + EXT3_DESC_PER_BLOCK(sb) - 1) /
-		   EXT3_DESC_PER_BLOCK(sb);
+	db_count = DIV_ROUND_UP(sbi->s_groups_count, EXT3_DESC_PER_BLOCK(sb));
 	sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *),
 				    GFP_KERNEL);
 	if (sbi->s_group_desc == NULL) {
Signature · 1 line
1.7.0.4
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR