0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LINUX_DM_DIRTY_LOG
0011 #define _LINUX_DM_DIRTY_LOG
0012
0013 #ifdef __KERNEL__
0014
0015 #include <linux/types.h>
0016 #include <linux/device-mapper.h>
0017
0018 typedef sector_t region_t;
0019
0020 struct dm_dirty_log_type;
0021
0022 struct dm_dirty_log {
0023 struct dm_dirty_log_type *type;
0024 int (*flush_callback_fn)(struct dm_target *ti);
0025 void *context;
0026 };
0027
0028 struct dm_dirty_log_type {
0029 const char *name;
0030 struct module *module;
0031
0032
0033 struct list_head list;
0034
0035 int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti,
0036 unsigned argc, char **argv);
0037 void (*dtr)(struct dm_dirty_log *log);
0038
0039
0040
0041
0042
0043 int (*presuspend)(struct dm_dirty_log *log);
0044 int (*postsuspend)(struct dm_dirty_log *log);
0045 int (*resume)(struct dm_dirty_log *log);
0046
0047
0048
0049
0050
0051 uint32_t (*get_region_size)(struct dm_dirty_log *log);
0052
0053
0054
0055
0056
0057 int (*is_clean)(struct dm_dirty_log *log, region_t region);
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070 int (*in_sync)(struct dm_dirty_log *log, region_t region,
0071 int can_block);
0072
0073
0074
0075
0076
0077 int (*flush)(struct dm_dirty_log *log);
0078
0079
0080
0081
0082
0083
0084
0085 void (*mark_region)(struct dm_dirty_log *log, region_t region);
0086 void (*clear_region)(struct dm_dirty_log *log, region_t region);
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100 int (*get_resync_work)(struct dm_dirty_log *log, region_t *region);
0101
0102
0103
0104
0105
0106
0107 void (*set_region_sync)(struct dm_dirty_log *log,
0108 region_t region, int in_sync);
0109
0110
0111
0112
0113 region_t (*get_sync_count)(struct dm_dirty_log *log);
0114
0115
0116
0117
0118 int (*status)(struct dm_dirty_log *log, status_type_t status_type,
0119 char *result, unsigned maxlen);
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129 int (*is_remote_recovering)(struct dm_dirty_log *log, region_t region);
0130 };
0131
0132 int dm_dirty_log_type_register(struct dm_dirty_log_type *type);
0133 int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type);
0134
0135
0136
0137
0138
0139 struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
0140 struct dm_target *ti,
0141 int (*flush_callback_fn)(struct dm_target *ti),
0142 unsigned argc, char **argv);
0143 void dm_dirty_log_destroy(struct dm_dirty_log *log);
0144
0145 #endif
0146 #endif