[lvm-devel] [PATCH 05/14] Refactor and add code for (lv) 'convert_lv' get function.

Petr Rockai prockai at redhat.com
Tue Oct 12 15:55:44 UTC 2010


Hi,

Dave Wysochanski <dwysocha at redhat.com> writes:

>> > +char *lv_convert_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
>> > +{
>> > +	struct lv_segment *seg;
>> > +	const char *name = NULL;
>> > +
>> > +	if (lv->status & CONVERTING) {
>> > +		if (lv->status & MIRRORED) {
>> > +			seg = first_seg(lv);
>> > +
>> > +			/* Temporary mirror is always area_num == 0 */
>> > +			if (seg_type(seg, 0) == AREA_LV &&
>> > +			    is_temporary_mirror_layer(seg_lv(seg, 0)))
>> > +				name = seg_lv(seg, 0)->name;
>> > +		}
>> > +	}
>> > +	if (name)
>> > +		return dm_pool_strndup(mem, name, strlen(name) + 1);
>> > +	return NULL;
>> > +}

> Done.  I also simplified the lv->status checks:
>
> +char *lv_convert_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
> +{
> +       struct lv_segment *seg;
> +
> +       if (lv->status & (CONVERTING|MIRRORED)) {
> +               seg = first_seg(lv);
> +
> +               /* Temporary mirror is always area_num == 0 */
> +               if (seg_type(seg, 0) == AREA_LV &&
> +                   is_temporary_mirror_layer(seg_lv(seg, 0)))
> +                       return dm_pool_strdup(mem, seg_lv(seg, 0)->name);
> +       }
> +       return NULL;
> +}
>

Looks OK to me. So the first ~half of the patches should be ready to go
in. I haven't noticed any forward dependencies, so you can check in what
we have (unless I have missed something), I'll get through more of the
review later today.

Yours,
   Petr.




More information about the lvm-devel mailing list