74777e0f80df94a35b2fefde6c4c1277c380fbec
[safe/jmp/linux-2.6] / drivers / md / dm-exception-store.c
1 /*
2  * Copyright (C) 2001-2002 Sistina Software (UK) Limited.
3  * Copyright (C) 2006-2008 Red Hat GmbH
4  *
5  * This file is released under the GPL.
6  */
7
8 #include "dm-exception-store.h"
9
10 #include <linux/mm.h>
11 #include <linux/pagemap.h>
12 #include <linux/vmalloc.h>
13 #include <linux/slab.h>
14 #include <linux/device-mapper.h>
15
16 #define DM_MSG_PREFIX "snapshot exception stores"
17
18 int dm_exception_store_init(void)
19 {
20         int r;
21
22         r = dm_transient_snapshot_init();
23         if (r) {
24                 DMERR("Unable to register transient exception store type.");
25                 goto transient_fail;
26         }
27
28         r = dm_persistent_snapshot_init();
29         if (r) {
30                 DMERR("Unable to register persistent exception store type");
31                 goto persistent_fail;
32         }
33
34         return 0;
35
36 persistent_fail:
37         dm_persistent_snapshot_exit();
38 transient_fail:
39         return r;
40 }
41
42 void dm_exception_store_exit(void)
43 {
44         dm_persistent_snapshot_exit();
45         dm_transient_snapshot_exit();
46 }