[lvm-devel] [PATCH 2/11] Add upward link from underlying LV to stacked seg
Jun'ichi Nomura
j-nomura at ce.jp.nec.com
Tue Jan 15 16:39:13 UTC 2008
Alasdair,
thanks for the comments.
Alasdair G Kergon wrote:
> /*
> + * Add/remove upward link from underlying LV to the segment using it
> + */
> +int lv_add_user_seg(struct logical_volume *lv, struct lv_segment *seg);
> +int lv_remove_user_seg(struct logical_volume *lv, struct lv_segment *seg);
>
> need to rename - too ambiguous
How about this?
add_seg_to_segs_using_this_lv(lv, seg)
remove_seg_from_segs_using_this_lv(lv, seg)
Or this?
add_parent_seg(lv, seg)
remove_parent_seg(lv, seg)
> +/*
> + * This is a function specialized for the common case where there is
> + * only one segment which uses the LV.
> + * e.g. the LV is a layer inserted by insert_layer_for_lv().
> + *
> + * In general, walk through lv->segs_using_this_lv.
> + */
> +struct lv_segment *seg_using_lv(struct logical_volume *lv)
> +{
> + struct seg_list *sl;
> +
> + if (list_size(&lv->segs_using_this_lv) != 1)
> + return NULL;
>
> Is it ever valid to return here and not have an error?
Returning NULL is valid if the list is empty.
But it should print error if the list has more than 1 items.
> @@ -110,8 +110,8 @@ int check_lv_segments(struct logical_vol
> }
>
> Where is this new list validated?
Some validation were included in the tests using find_mirror_seg().
I'll add generic ones.
Thanks,
--
Jun'ichi Nomura, NEC Corporation of America
More information about the lvm-devel
mailing list