[Ocfs2-tools-devel] [PATCH 13/22] tunefs rework: Add op_resize_volume.c

Joel Becker Joel.Becker at oracle.com
Wed Aug 6 18:56:36 PDT 2008


On Wed, Aug 06, 2008 at 06:45:04PM -0700, Mark Fasheh wrote:
> On Fri, Jul 25, 2008 at 07:07:51PM -0700, Joel Becker wrote:

<snip>

> > +
> > +static uint64_t clusters_in_bytes(ocfs2_filesys *fs, uint64_t bytes)
> > +{
> > +	uint64_t ret = bytes + fs->fs_clustersize - 1;
> > +
> > +	if (ret < bytes) /* deal with wrapping */
> > +		return UINT64_MAX;
> > +
> > +	return ret >> OCFS2_RAW_SB(fs->fs_super)->s_clustersize_bits;
> > +}
> > +
> > +static uint64_t clusters_to_bytes(ocfs2_filesys *fs, uint64_t clusters)
> > +{
> > +	uint64_t ret =
> > +		clusters << OCFS2_RAW_SB(fs->fs_super)->s_clustersize_bits;
> > +
> > +	if (ret < clusters)
> > +		ret = UINT64_MAX;
> > +
> > +	return ret;
> > +}
> 
> Btw, these probably should go somewhere in libocfs2, right? I'm actually
> really surprised we don't have them there already.

	I assume you mean these two.  I considered putting them in
libocfs2, I was like "should I?"  Looks like the answer is yes.

> Anyway, I'm guess you probably got this from the old tunefs code, so I don't
> see this as something that should stop this patch from being committed
> as-is, but maybe a follow-up could move them?

	Well, the old tunefs code hand-coded it, without bounds checking
sometimes :-)  I cleaned it up to these funcs.  We can move them in this
series or afterwords.  Given that I have to respin some changes for
inline data, might as well do it now.

Joel

-- 

"You must remember this:
 A kiss is just a kiss,
 A sigh is just a sigh.
 The fundamental rules apply
 As time goes by."

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