[Ocfs2-tools-devel] [PATCH 02/22] libocfs2: Change ocfs2_group_bitmap_size.

Tao Ma tao.ma at oracle.com
Thu Apr 1 01:15:42 PDT 2010


Hi Joel,

Joel Becker wrote:
> On Thu, Apr 01, 2010 at 12:41:06PM +0800, Tao Ma wrote:
>> Change ocfs2_group_bitmap_size to accept parameters
>> suballocator and support_discontig_bg, currently all
>> the callers use 0.
>> Some of them will be changed later.
>>
>> Signed-off-by: Tao Ma <tao.ma at oracle.com>
>> ---
>>  debugfs.ocfs2/find_block_inode.c |    2 +-
>>  extras/compute_groups.c          |    2 +-
>>  fsck.ocfs2/pass0.c               |    4 +++-
>>  fswreck/chain.c                  |    2 +-
>>  fswreck/group.c                  |    2 +-
>>  include/ocfs2-kernel/ocfs2_fs.h  |   22 ++++++++++++++++------
>>  include/ocfs2/ocfs2.h            |    2 +-
>>  libocfs2/chainalloc.c            |    5 +++--
>>  mkfs.ocfs2/mkfs.c                |    5 +++--
>>  9 files changed, 30 insertions(+), 16 deletions(-)
>>
>> diff --git a/debugfs.ocfs2/find_block_inode.c b/debugfs.ocfs2/find_block_inode.c
>> index 293ce09..3ed8879 100644
>> --- a/debugfs.ocfs2/find_block_inode.c
>> +++ b/debugfs.ocfs2/find_block_inode.c
>> @@ -294,7 +294,7 @@ static void check_computed_blocks(ocfs2_filesys *fs, uint64_t gb_blkno,
>>  	if (*found >= count)
>>  		return;
>>  
>> -	cpg = ocfs2_group_bitmap_size(1 << fs->fs_blocksize) * 8;
>> +	cpg = ocfs2_group_bitmap_size(1 << fs->fs_blocksize, 0, 0) * 8;
> 
> 	First off, this code is buggy.  It was buggy even before this
> patch.  Passing (1 << fs_blocksize) overflows every integer type ;-)
oh, yeah, how could I skip them? ;)
> 
>> -	cpg= 8 * ocfs2_group_bitmap_size(fs->fs_blocksize);
>> +	cpg = 8 * ocfs2_group_bitmap_size(fs->fs_blocksize, 0, 0);
> 
> 	Secondly, this interface is ugly.  What do those zeros even
> mean?  That's partially my fault; I added the first 0.  But now that we
> have more than one, can we think of an easier way to read it?
> 	The kernel was solved because we had the superblock.  We don't
> here.
How about add 2 new members in ocfs2_filesys? In that case we can only 
call it twice in ocfs2_filesys initialization, and just pass it here. 
That way, we will have only one ugly place and of course the caller 
knows what type of allocator it uses. ;) But As for the solution for 
ocfs2_group_bitmap_size, I don't have a idea either.

Regards,
Tao



More information about the Ocfs2-tools-devel mailing list