Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * Copyright (C) 2001-2002 Sistina Software (UK) Limited. |
Alasdair G Kergon | 4db6bfe | 2009-01-06 03:05:17 +0000 | [diff] [blame^] | 3 | * Copyright (C) 2006-2008 Red Hat GmbH |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * |
5 | * This file is released under the GPL. | ||||
6 | */ | ||||
7 | |||||
Jonathan Brassow | aea53d9 | 2009-01-06 03:05:15 +0000 | [diff] [blame] | 8 | #include "dm-exception-store.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | |
10 | #include <linux/mm.h> | ||||
11 | #include <linux/pagemap.h> | ||||
12 | #include <linux/vmalloc.h> | ||||
13 | #include <linux/slab.h> | ||||
Alasdair G Kergon | 4db6bfe | 2009-01-06 03:05:17 +0000 | [diff] [blame^] | 14 | #include <linux/device-mapper.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | |
Alasdair G Kergon | 4db6bfe | 2009-01-06 03:05:17 +0000 | [diff] [blame^] | 16 | #define DM_MSG_PREFIX "snapshot exception stores" |
Alasdair G Kergon | 72d9486 | 2006-06-26 00:27:35 -0700 | [diff] [blame] | 17 | |
Alasdair G Kergon | 4db6bfe | 2009-01-06 03:05:17 +0000 | [diff] [blame^] | 18 | int dm_exception_store_init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | { |
20 | int r; | ||||
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
Alasdair G Kergon | 4db6bfe | 2009-01-06 03:05:17 +0000 | [diff] [blame^] | 22 | r = dm_transient_snapshot_init(); |
23 | if (r) { | ||||
24 | DMERR("Unable to register transient exception store type."); | ||||
25 | goto transient_fail; | ||||
26 | } | ||||
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | |
Alasdair G Kergon | 4db6bfe | 2009-01-06 03:05:17 +0000 | [diff] [blame^] | 28 | r = dm_persistent_snapshot_init(); |
29 | if (r) { | ||||
30 | DMERR("Unable to register persistent exception store type"); | ||||
31 | goto persistent_fail; | ||||
32 | } | ||||
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
Alasdair G Kergon | 4db6bfe | 2009-01-06 03:05:17 +0000 | [diff] [blame^] | 36 | persistent_fail: |
37 | dm_persistent_snapshot_exit(); | ||||
38 | transient_fail: | ||||
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | return r; |
40 | } | ||||
41 | |||||
Alasdair G Kergon | 4db6bfe | 2009-01-06 03:05:17 +0000 | [diff] [blame^] | 42 | void dm_exception_store_exit(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | { |
Alasdair G Kergon | 4db6bfe | 2009-01-06 03:05:17 +0000 | [diff] [blame^] | 44 | dm_persistent_snapshot_exit(); |
45 | dm_transient_snapshot_exit(); | ||||
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | } |