diff options
author | Milan Broz <mbroz@redhat.com> | 2006-12-08 05:41:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:29:09 -0500 |
commit | 31c93a0c29bf96efd806ccf4ee81cacf04f255de (patch) | |
tree | dad0b4ce13c5efb82a5bff72fbd1a41b08042c99 | |
parent | 45e157206c732613d1c07e8ceeb1a3e497fb2abf (diff) |
[PATCH] dm: snapshot: abstract memory release
Move the code that releases memory used by a snapshot into a separate function.
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Cc: dm-devel@redhat.com
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/md/dm-snap.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index bbf861e4fed1..50e084df554e 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -564,6 +564,17 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
564 | return r; | 564 | return r; |
565 | } | 565 | } |
566 | 566 | ||
567 | static void __free_exceptions(struct dm_snapshot *s) | ||
568 | { | ||
569 | kcopyd_client_destroy(s->kcopyd_client); | ||
570 | s->kcopyd_client = NULL; | ||
571 | |||
572 | exit_exception_table(&s->pending, pending_cache); | ||
573 | exit_exception_table(&s->complete, exception_cache); | ||
574 | |||
575 | s->store.destroy(&s->store); | ||
576 | } | ||
577 | |||
567 | static void snapshot_dtr(struct dm_target *ti) | 578 | static void snapshot_dtr(struct dm_target *ti) |
568 | { | 579 | { |
569 | struct dm_snapshot *s = (struct dm_snapshot *) ti->private; | 580 | struct dm_snapshot *s = (struct dm_snapshot *) ti->private; |
@@ -574,13 +585,7 @@ static void snapshot_dtr(struct dm_target *ti) | |||
574 | /* After this returns there can be no new kcopyd jobs. */ | 585 | /* After this returns there can be no new kcopyd jobs. */ |
575 | unregister_snapshot(s); | 586 | unregister_snapshot(s); |
576 | 587 | ||
577 | kcopyd_client_destroy(s->kcopyd_client); | 588 | __free_exceptions(s); |
578 | |||
579 | exit_exception_table(&s->pending, pending_cache); | ||
580 | exit_exception_table(&s->complete, exception_cache); | ||
581 | |||
582 | /* Deallocate memory used */ | ||
583 | s->store.destroy(&s->store); | ||
584 | 589 | ||
585 | dm_put_device(ti, s->origin); | 590 | dm_put_device(ti, s->origin); |
586 | dm_put_device(ti, s->cow); | 591 | dm_put_device(ti, s->cow); |