Commit 87a8f240 authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Alasdair G Kergon

dm log: add flush callback fn

Introduce a callback pointer from the log to dm-raid1 layer.

Before some region is set as "in-sync", we need to flush hardware cache on
all the disks. But the log module doesn't have access to the mirror_set
structure. So it will use this callback.

So far the callback is unused, it will be used in further patches.
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent 5adc78d0
...@@ -145,8 +145,9 @@ int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type) ...@@ -145,8 +145,9 @@ int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type)
EXPORT_SYMBOL(dm_dirty_log_type_unregister); EXPORT_SYMBOL(dm_dirty_log_type_unregister);
struct dm_dirty_log *dm_dirty_log_create(const char *type_name, struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
struct dm_target *ti, struct dm_target *ti,
unsigned int argc, char **argv) int (*flush_callback_fn)(struct dm_target *ti),
unsigned int argc, char **argv)
{ {
struct dm_dirty_log_type *type; struct dm_dirty_log_type *type;
struct dm_dirty_log *log; struct dm_dirty_log *log;
...@@ -161,6 +162,7 @@ struct dm_dirty_log *dm_dirty_log_create(const char *type_name, ...@@ -161,6 +162,7 @@ struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
return NULL; return NULL;
} }
log->flush_callback_fn = flush_callback_fn;
log->type = type; log->type = type;
if (type->ctr(log, ti, argc, argv)) { if (type->ctr(log, ti, argc, argv)) {
kfree(log); kfree(log);
......
...@@ -896,7 +896,7 @@ static struct dm_dirty_log *create_dirty_log(struct dm_target *ti, ...@@ -896,7 +896,7 @@ static struct dm_dirty_log *create_dirty_log(struct dm_target *ti,
return NULL; return NULL;
} }
dl = dm_dirty_log_create(argv[0], ti, param_count, argv + 2); dl = dm_dirty_log_create(argv[0], ti, NULL, param_count, argv + 2);
if (!dl) { if (!dl) {
ti->error = "Error creating mirror dirty log"; ti->error = "Error creating mirror dirty log";
return NULL; return NULL;
......
...@@ -21,6 +21,7 @@ struct dm_dirty_log_type; ...@@ -21,6 +21,7 @@ struct dm_dirty_log_type;
struct dm_dirty_log { struct dm_dirty_log {
struct dm_dirty_log_type *type; struct dm_dirty_log_type *type;
int (*flush_callback_fn)(struct dm_target *ti);
void *context; void *context;
}; };
...@@ -136,8 +137,9 @@ int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type); ...@@ -136,8 +137,9 @@ int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type);
* type->constructor/destructor() directly. * type->constructor/destructor() directly.
*/ */
struct dm_dirty_log *dm_dirty_log_create(const char *type_name, struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
struct dm_target *ti, struct dm_target *ti,
unsigned argc, char **argv); int (*flush_callback_fn)(struct dm_target *ti),
unsigned argc, char **argv);
void dm_dirty_log_destroy(struct dm_dirty_log *log); void dm_dirty_log_destroy(struct dm_dirty_log *log);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment