-
Notifications
You must be signed in to change notification settings - Fork 2
/
dm-ovbd.c
45 lines (38 loc) · 1.05 KB
/
dm-ovbd.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// SPDX-License-Identifier: GPL-2.0
#include <linux/module.h>
#include "dm-ovbd.h"
static struct ovbd_context global_ovbd_context;
static int __init init_ovbd_target(void)
{
global_ovbd_context.wq =
alloc_workqueue("ovbd", WQ_MEM_RECLAIM | WQ_FREEZABLE | WQ_UNBOUND, 0);
if (IS_ERR(global_ovbd_context.wq))
return -1;
if (init_lsmt_target() < 0)
goto error_out;
if (init_zfile_target() < 0)
goto error_out;
pr_info("OVBD initialized");
return 0;
error_out:
destroy_workqueue(global_ovbd_context.wq);
return -1;
}
static void __exit cleanup_ovbd_target(void)
{
cleanup_zfile_target();
cleanup_lsmt_target();
flush_workqueue(global_ovbd_context.wq);
destroy_workqueue(global_ovbd_context.wq);
global_ovbd_context.wq = NULL;
pr_info("OVBD cleared");
}
struct ovbd_context *get_ovbd_context(void)
{
return &global_ovbd_context;
}
module_init(init_ovbd_target);
module_exit(cleanup_ovbd_target);
MODULE_AUTHOR("Rui Du <[email protected]>");
MODULE_DESCRIPTION("DADI OverlayBD implementation as device mapper target");
MODULE_LICENSE("GPL");