[PATCH 03/14] Refactor and add code for (lv) 'origin_size' get function.

Dave Wysochanski <[email protected]>
Newsgroups dev.linux.lists.lvm-devel
Message-ID <1286893366.15299.5.camel@f12-work>
On Mon, 2010-10-11 at 20:13 +0200, Petr Rockai wrote:
> Dave Wysochanski <[email protected]> writes:
> 
> > Signed-off-by: Dave Wysochanski <[email protected]>
> Reviewed-By: Petr Rockai <[email protected]>
> 
> >  
> > +uint64_t lv_origin_size(const struct logical_volume *lv)
> > +{
> > +	uint64_t size;
> > +
> > +	if (lv_is_cow(lv))
> > +		size = (uint64_t) find_cow(lv)->len * lv->vg->extent_size;
> > +	else if (lv_is_origin(lv))
> > +		size = lv->size;
> > +	else
> > +		size = UINT64_C(0);
> > +	return size;
> > +}
> You don't need the UINT64_C there. size = 0 will work, you know. :)
> Also, I would be inclined to write instead:
> 
> uint64_t lv_origin_size(const struct logical_volume *lv)
> {
> 	if (lv_is_cow(lv))
> 		return (uint64_t) find_cow(lv)->len * lv->vg->extent_size;
> 	if (lv_is_origin(lv))
> 		return lv->size;
> 	return 0;
> }
> 
> which has the same effect.
> 

Very good.  An excellent cleanup - thanks.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.