提交 31c93a0c 编写于 作者: M Milan Broz 提交者: Linus Torvalds

[PATCH] dm: snapshot: abstract memory release

Move the code that releases memory used by a snapshot into a separate function.
Signed-off-by: NMilan Broz <mbroz@redhat.com>
Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
Cc: dm-devel@redhat.com
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 45e15720
...@@ -564,6 +564,17 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) ...@@ -564,6 +564,17 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
return r; return r;
} }
static void __free_exceptions(struct dm_snapshot *s)
{
kcopyd_client_destroy(s->kcopyd_client);
s->kcopyd_client = NULL;
exit_exception_table(&s->pending, pending_cache);
exit_exception_table(&s->complete, exception_cache);
s->store.destroy(&s->store);
}
static void snapshot_dtr(struct dm_target *ti) static void snapshot_dtr(struct dm_target *ti)
{ {
struct dm_snapshot *s = (struct dm_snapshot *) ti->private; struct dm_snapshot *s = (struct dm_snapshot *) ti->private;
...@@ -574,13 +585,7 @@ static void snapshot_dtr(struct dm_target *ti) ...@@ -574,13 +585,7 @@ static void snapshot_dtr(struct dm_target *ti)
/* After this returns there can be no new kcopyd jobs. */ /* After this returns there can be no new kcopyd jobs. */
unregister_snapshot(s); unregister_snapshot(s);
kcopyd_client_destroy(s->kcopyd_client); __free_exceptions(s);
exit_exception_table(&s->pending, pending_cache);
exit_exception_table(&s->complete, exception_cache);
/* Deallocate memory used */
s->store.destroy(&s->store);
dm_put_device(ti, s->origin); dm_put_device(ti, s->origin);
dm_put_device(ti, s->cow); dm_put_device(ti, s->cow);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册