[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [lvm-devel] [PATCH 03/14] Refactor and add code for (lv) 'origin_size' get function.



On Mon, 2010-10-11 at 20:13 +0200, Petr Rockai wrote:
> Dave Wysochanski <dwysocha redhat com> writes:
> 
> > Signed-off-by: Dave Wysochanski <dwysocha redhat com>
> Reviewed-By: Petr Rockai <prockai redhat com>
> 
> >  
> > +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.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]