Patchwork mke2fs: do not initialize block bitmaps of groups having super block

login
register
mail settings
Submitter Yongqiang Yang
Date Nov. 9, 2011, 10:53 a.m.
Message ID <1320836006-6946-1-git-send-email-xiaoqiangnk@gmail.com>
Download mbox | patch
Permalink /patch/124547/
State New
Headers show

Comments

Yongqiang Yang - Nov. 9, 2011, 10:53 a.m.
Now mke2fs initializes block bitmaps of groups having super block, on
the other hand ext4_init_block_bitmap in kernel can handle this case
rightly.  So let mke2fs let block bitmaps of groups having super block
be uninitialized.

Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
---
 lib/ext2fs/alloc_sb.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
Andreas Dilger - Nov. 9, 2011, 4:23 p.m.
On 2011-11-09, at 3:53 AM, Yongqiang Yang <xiaoqiangnk@gmail.com> wrote:

> Now mke2fs initializes block bitmaps of groups having super block, on
> the other hand ext4_init_block_bitmap in kernel can handle this case
> rightly.  So let mke2fs let block bitmaps of groups having super block
> be uninitialized.

Is that true of older kernels, or only newer ones?  What about filesystems with META_BG set?

Cheers, Andreas

> Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
> ---
> lib/ext2fs/alloc_sb.c |    2 --
> 1 files changed, 0 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/ext2fs/alloc_sb.c b/lib/ext2fs/alloc_sb.c
> index 0d1c000..7517fbc 100644
> --- a/lib/ext2fs/alloc_sb.c
> +++ b/lib/ext2fs/alloc_sb.c
> @@ -65,8 +65,6 @@ int ext2fs_reserve_super_and_bgd(ext2_filsys fs,
>        ext2fs_mark_block_bitmap2(bmap, 0);
> 
>    if (old_desc_blk) {
> -        if (fs->super->s_reserved_gdt_blocks && fs->block_map == bmap)
> -            ext2fs_bg_flags_clear(fs, group, EXT2_BG_BLOCK_UNINIT);
>        for (j=0; j < old_desc_blocks; j++)
>            if (old_desc_blk + j < ext2fs_blocks_count(fs->super))
>                ext2fs_mark_block_bitmap2(bmap,
> -- 
> 1.7.5.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o - Nov. 9, 2011, 8:34 p.m.
On Nov 9, 2011, at 11:23 AM, Andreas Dilger wrote:

> On 2011-11-09, at 3:53 AM, Yongqiang Yang <xiaoqiangnk@gmail.com> wrote:
> 
>> Now mke2fs initializes block bitmaps of groups having super block, on
>> the other hand ext4_init_block_bitmap in kernel can handle this case
>> rightly.  So let mke2fs let block bitmaps of groups having super block
>> be uninitialized.
> 
> Is that true of older kernels, or only newer ones?  What about filesystems with META_BG set?

More to the point, what about file systems that don't have uninit_bg set?

What's the reason for wanting to make this change?

-- Ted


--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yongqiang Yang - Nov. 10, 2011, 1:55 a.m.
On Thu, Nov 10, 2011 at 12:23 AM, Andreas Dilger <adilger@dilger.ca> wrote:
> On 2011-11-09, at 3:53 AM, Yongqiang Yang <xiaoqiangnk@gmail.com> wrote:
>
>> Now mke2fs initializes block bitmaps of groups having super block, on
>> the other hand ext4_init_block_bitmap in kernel can handle this case
>> rightly.  So let mke2fs let block bitmaps of groups having super block
>> be uninitialized.
>
> Is that true of older kernels, or only newer ones?  What about filesystems with META_BG set?
According to code of kernel 2.6.24 in which uninit_bg was introduced
in, kernel can handle the case and META_BG can also be handled
rightly.  But it was not tested.  I will do a test later.

Yongqiang.
>
> Cheers, Andreas
>
>> Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
>> ---
>> lib/ext2fs/alloc_sb.c |    2 --
>> 1 files changed, 0 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/ext2fs/alloc_sb.c b/lib/ext2fs/alloc_sb.c
>> index 0d1c000..7517fbc 100644
>> --- a/lib/ext2fs/alloc_sb.c
>> +++ b/lib/ext2fs/alloc_sb.c
>> @@ -65,8 +65,6 @@ int ext2fs_reserve_super_and_bgd(ext2_filsys fs,
>>        ext2fs_mark_block_bitmap2(bmap, 0);
>>
>>    if (old_desc_blk) {
>> -        if (fs->super->s_reserved_gdt_blocks && fs->block_map == bmap)
>> -            ext2fs_bg_flags_clear(fs, group, EXT2_BG_BLOCK_UNINIT);
>>        for (j=0; j < old_desc_blocks; j++)
>>            if (old_desc_blk + j < ext2fs_blocks_count(fs->super))
>>                ext2fs_mark_block_bitmap2(bmap,
>> --
>> 1.7.5.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Yongqiang Yang - Nov. 10, 2011, 2:07 a.m.
On Thu, Nov 10, 2011 at 4:34 AM, Theodore Tso <tytso@mit.edu> wrote:
>
> On Nov 9, 2011, at 11:23 AM, Andreas Dilger wrote:
>
>> On 2011-11-09, at 3:53 AM, Yongqiang Yang <xiaoqiangnk@gmail.com> wrote:
>>
>>> Now mke2fs initializes block bitmaps of groups having super block, on
>>> the other hand ext4_init_block_bitmap in kernel can handle this case
>>> rightly.  So let mke2fs let block bitmaps of groups having super block
>>> be uninitialized.
>>
>> Is that true of older kernels, or only newer ones?  What about filesystems with META_BG set?
>
> More to the point, what about file systems that don't have uninit_bg set?
mke2fs does not set BLOCK_UNINIT flag for file systems which do not
have uninit_bg set from the beginning.


>
> What's the reason for wanting to make this change?
The different handling to some groups let readers think that we have
to handle these groups this way, otherwise errors will happen.
Actually, no error will happen.   IMHO this can make both logic and
code much clearer.

Yongqiang.
>
> -- Ted
>
>
>

Patch

diff --git a/lib/ext2fs/alloc_sb.c b/lib/ext2fs/alloc_sb.c
index 0d1c000..7517fbc 100644
--- a/lib/ext2fs/alloc_sb.c
+++ b/lib/ext2fs/alloc_sb.c
@@ -65,8 +65,6 @@  int ext2fs_reserve_super_and_bgd(ext2_filsys fs,
 		ext2fs_mark_block_bitmap2(bmap, 0);
 
 	if (old_desc_blk) {
-		if (fs->super->s_reserved_gdt_blocks && fs->block_map == bmap)
-			ext2fs_bg_flags_clear(fs, group, EXT2_BG_BLOCK_UNINIT);
 		for (j=0; j < old_desc_blocks; j++)
 			if (old_desc_blk + j < ext2fs_blocks_count(fs->super))
 				ext2fs_mark_block_bitmap2(bmap,