[lvm-devel] [PATCH 2/11] Add upward link from underlying LV to stacked seg

Alasdair G Kergon agk at redhat.com
Tue Jan 15 16:56:24 UTC 2008


On Tue, Jan 15, 2008 at 11:39:13AM -0500, Jun'ichi Nomura wrote:
> 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)

Not sure.  Still thinking.
 
> > +struct lv_segment *seg_using_lv(struct logical_volume *lv)

> Returning NULL is valid if the list is empty.

What I mean is: why would the list be empty if that function
is being called?  If the list was known to be empty, you
wouldn't be in a code path that called the function, surely?
IOW it's a coding error if 'return NULL' is hit.
Or does the function have a secondary use to find out whether
the LV is at the top of the stack?
Is it better split into two?  First an is_ function to find out
if the segment is the type expected with a single segment; then the function to
give details of the one-and-only segment?

> > Where is this new list validated?
> Some validation were included in the tests using find_mirror_seg().
> I'll add generic ones.
 
I mean the validation in the vg_write() path must have independent
validity checks so we never write out the metadata if there's
an internal inconsistency in it.  IOW it must be done somewhere under
vg_validate().  IOW the pointers must be validated in both directions:
all existing list elements are correct (and not duplicated), and no
elements are missing from the list.

Alasdair
-- 
agk at redhat.com




More information about the lvm-devel mailing list