blob: dccbfb0e010fafc7b3470f06de29132b18124e57 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * Copyright (C) 2001-2002 Sistina Software (UK) Limited.
Alasdair G Kergon4db6bfe2009-01-06 03:05:17 +00003 * Copyright (C) 2006-2008 Red Hat GmbH
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
5 * This file is released under the GPL.
6 */
7
Jonathan Brassowaea53d92009-01-06 03:05:15 +00008#include "dm-exception-store.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -07009
10#include <linux/mm.h>
11#include <linux/pagemap.h>
12#include <linux/vmalloc.h>
13#include <linux/slab.h>
14
Alasdair G Kergon4db6bfe2009-01-06 03:05:17 +000015#define DM_MSG_PREFIX "snapshot exception stores"
Alasdair G Kergon72d94862006-06-26 00:27:35 -070016
Alasdair G Kergon4db6bfe2009-01-06 03:05:17 +000017int dm_exception_store_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070018{
19 int r;
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
Alasdair G Kergon4db6bfe2009-01-06 03:05:17 +000021 r = dm_transient_snapshot_init();
22 if (r) {
23 DMERR("Unable to register transient exception store type.");
24 goto transient_fail;
25 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
Alasdair G Kergon4db6bfe2009-01-06 03:05:17 +000027 r = dm_persistent_snapshot_init();
28 if (r) {
29 DMERR("Unable to register persistent exception store type");
30 goto persistent_fail;
31 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070034
Alasdair G Kergon4db6bfe2009-01-06 03:05:17 +000035persistent_fail:
36 dm_persistent_snapshot_exit();
37transient_fail:
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 return r;
39}
40
Alasdair G Kergon4db6bfe2009-01-06 03:05:17 +000041void dm_exception_store_exit(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070042{
Alasdair G Kergon4db6bfe2009-01-06 03:05:17 +000043 dm_persistent_snapshot_exit();
44 dm_transient_snapshot_exit();
Linus Torvalds1da177e2005-04-16 15:20:36 -070045}