1
2
3
4
5
6
7
8
9
10#ifndef _LINUX_DM_DIRTY_LOG
11#define _LINUX_DM_DIRTY_LOG
12
13#ifdef __KERNEL__
14
15#include <linux/types.h>
16#include <linux/device-mapper.h>
17
18typedef sector_t region_t;
19
20struct dm_dirty_log_type;
21
22struct dm_dirty_log {
23 struct dm_dirty_log_type *type;
24 void *context;
25};
26
27struct dm_dirty_log_type {
28 const char *name;
29 struct module *module;
30
31
32 struct list_head list;
33
34 int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti,
35 unsigned argc, char **argv);
36 void (*dtr)(struct dm_dirty_log *log);
37
38
39
40
41
42 int (*presuspend)(struct dm_dirty_log *log);
43 int (*postsuspend)(struct dm_dirty_log *log);
44 int (*resume)(struct dm_dirty_log *log);
45
46
47
48
49
50 uint32_t (*get_region_size)(struct dm_dirty_log *log);
51
52
53
54
55
56 int (*is_clean)(struct dm_dirty_log *log, region_t region);
57
58
59
60
61
62
63
64
65
66
67
68
69 int (*in_sync)(struct dm_dirty_log *log, region_t region,
70 int can_block);
71
72
73
74
75
76 int (*flush)(struct dm_dirty_log *log);
77
78
79
80
81
82
83
84 void (*mark_region)(struct dm_dirty_log *log, region_t region);
85 void (*clear_region)(struct dm_dirty_log *log, region_t region);
86
87
88
89
90
91
92
93
94
95
96
97
98
99 int (*get_resync_work)(struct dm_dirty_log *log, region_t *region);
100
101
102
103
104
105
106 void (*set_region_sync)(struct dm_dirty_log *log,
107 region_t region, int in_sync);
108
109
110
111
112 region_t (*get_sync_count)(struct dm_dirty_log *log);
113
114
115
116
117 int (*status)(struct dm_dirty_log *log, status_type_t status_type,
118 char *result, unsigned maxlen);
119
120
121
122
123
124
125
126
127
128 int (*is_remote_recovering)(struct dm_dirty_log *log, region_t region);
129};
130
131int dm_dirty_log_type_register(struct dm_dirty_log_type *type);
132int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type);
133
134
135
136
137
138struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
139 struct dm_target *ti,
140 unsigned argc, char **argv);
141void dm_dirty_log_destroy(struct dm_dirty_log *log);
142
143#endif
144#endif
145