blob: 74777e0f80df94a35b2fefde6c4c1277c380fbec [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>
Alasdair G Kergon4db6bfe2009-01-06 03:05:17 +000014#include <linux/device-mapper.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
Alasdair G Kergon4db6bfe2009-01-06 03:05:17 +000016#define DM_MSG_PREFIX "snapshot exception stores"
Alasdair G Kergon72d94862006-06-26 00:27:35 -070017
Alasdair G Kergon4db6bfe2009-01-06 03:05:17 +000018int dm_exception_store_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070019{
20 int r;
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
Alasdair G Kergon4db6bfe2009-01-06 03:05:17 +000022 r = dm_transient_snapshot_init();
23 if (r) {
24 DMERR("Unable to register transient exception store type.");
25 goto transient_fail;
26 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
Alasdair G Kergon4db6bfe2009-01-06 03:05:17 +000028 r = dm_persistent_snapshot_init();
29 if (r) {
30 DMERR("Unable to register persistent exception store type");
31 goto persistent_fail;
32 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
Alasdair G Kergon4db6bfe2009-01-06 03:05:17 +000036persistent_fail:
37 dm_persistent_snapshot_exit();
38transient_fail:
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 return r;
40}
41
Alasdair G Kergon4db6bfe2009-01-06 03:05:17 +000042void dm_exception_store_exit(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070043{
Alasdair G Kergon4db6bfe2009-01-06 03:05:17 +000044 dm_persistent_snapshot_exit();
45 dm_transient_snapshot_exit();
Linus Torvalds1da177e2005-04-16 15:20:36 -070046}