Patchwork ext3: Use DIV_ROUND_UP() on group desc block counting

login
register
mail settings
Submitter Namhyung Kim
Date Oct. 11, 2010, 10:38 a.m.
Message ID <1286793519-3774-1-git-send-email-namhyung@gmail.com>
Download mbox | patch
Permalink /patch/67410/
State Not Applicable
Headers show

Comments

Namhyung Kim - Oct. 11, 2010, 10:38 a.m.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 fs/ext3/super.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
Jan Kara - Oct. 11, 2010, 2:45 p.m.
On Mon 11-10-10 19:38:39, Namhyung Kim wrote:
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
  OK. Merged.

								Honza
> ---
>  fs/ext3/super.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext3/super.c b/fs/ext3/super.c
> index 75bbf77..3fce402 100644
> --- a/fs/ext3/super.c
> +++ b/fs/ext3/super.c
> @@ -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) {
> -- 
> 1.7.0.4
>

Patch

diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 75bbf77..3fce402 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -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) {