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

Joel Becker Joel.Becker at oracle.com
Thu Apr 1 00:48:32 PDT 2010


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 ;-)

> -	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.

Joel

-- 

"There are some experiences in life which should not be demanded
 twice from any man, and one of them is listening to the Brahms Requiem."
        - George Bernard Shaw

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list