diff options
author | NeilBrown <neilb@suse.de> | 2010-12-16 12:10:01 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-12-16 12:10:01 +1100 |
commit | cb23f1f4c33d495c05a37ded7acecdeaebdabf14 (patch) | |
tree | ef44ad4804091344644379ed6504a73faafea204 /managemon.c | |
parent | 78b10e663c35a301406facbda3f5be02973e2ba4 (diff) |
Allow a metadata update to have a linked list of allocated spaces.
Sometimes one metadata update will require allocating several
larger data structures. As 'monitor' cannot allocate, 'manager'
must, so it must be able to attach a list of allocates to the
update, and importantly it must be able to easily free them.
So add a 'space_list' element to metadata updates where each
element on the list starts with a pointer to the next.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'managemon.c')
-rw-r--r-- | managemon.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/managemon.c b/managemon.c index 5cc50d8d..860e5785 100644 --- a/managemon.c +++ b/managemon.c @@ -217,10 +217,16 @@ static void free_updates(struct metadata_update **update) { while (*update) { struct metadata_update *this = *update; + void **space_list = this->space_list; *update = this->next; free(this->buf); free(this->space); + while (space_list) { + void *space = space_list; + space_list = *space_list; + free(space); + } free(this); } } @@ -710,6 +716,7 @@ static void handle_message(struct supertype *container, struct metadata_update * mu->buf = msg->buf; msg->buf = NULL; mu->space = NULL; + mu->space_list = NULL; mu->next = NULL; if (container->ss->prepare_update) container->ss->prepare_update(container, mu); |