aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2009-12-10 18:52:01 -0500
committerAlasdair G Kergon <agk@redhat.com>2009-12-10 18:52:01 -0500
commit87a8f240e9bcf025ba45e4563c842b0d59c5e8ef (patch)
treeb6b42a74fc1135c11656d8cf4bf5ea4005c74a77
parent5adc78d0d231b030405b31759f125f13404fdb64 (diff)
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: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
-rw-r--r--drivers/md/dm-log.c6
-rw-r--r--drivers/md/dm-raid1.c2
-rw-r--r--include/linux/dm-dirty-log.h6
3 files changed, 9 insertions, 5 deletions
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
index d779f8c915dd..666a80e3602e 100644
--- a/drivers/md/dm-log.c
+++ b/drivers/md/dm-log.c
@@ -145,8 +145,9 @@ int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type)
145EXPORT_SYMBOL(dm_dirty_log_type_unregister); 145EXPORT_SYMBOL(dm_dirty_log_type_unregister);
146 146
147struct dm_dirty_log *dm_dirty_log_create(const char *type_name, 147struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
148 struct dm_target *ti, 148 struct dm_target *ti,
149 unsigned int argc, char **argv) 149 int (*flush_callback_fn)(struct dm_target *ti),
150 unsigned int argc, char **argv)
150{ 151{
151 struct dm_dirty_log_type *type; 152 struct dm_dirty_log_type *type;
152 struct dm_dirty_log *log; 153 struct dm_dirty_log *log;
@@ -161,6 +162,7 @@ struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
161 return NULL; 162 return NULL;
162 } 163 }
163 164
165 log->flush_callback_fn = flush_callback_fn;
164 log->type = type; 166 log->type = type;
165 if (type->ctr(log, ti, argc, argv)) { 167 if (type->ctr(log, ti, argc, argv)) {
166 kfree(log); 168 kfree(log);
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 752a29e1855b..d44bc497dad9 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -896,7 +896,7 @@ static struct dm_dirty_log *create_dirty_log(struct dm_target *ti,
896 return NULL; 896 return NULL;
897 } 897 }
898 898
899 dl = dm_dirty_log_create(argv[0], ti, param_count, argv + 2); 899 dl = dm_dirty_log_create(argv[0], ti, NULL, param_count, argv + 2);
900 if (!dl) { 900 if (!dl) {
901 ti->error = "Error creating mirror dirty log"; 901 ti->error = "Error creating mirror dirty log";
902 return NULL; 902 return NULL;
diff --git a/include/linux/dm-dirty-log.h b/include/linux/dm-dirty-log.h
index 5e8b11d88f6f..7084503c3405 100644
--- a/include/linux/dm-dirty-log.h
+++ b/include/linux/dm-dirty-log.h
@@ -21,6 +21,7 @@ struct dm_dirty_log_type;
21 21
22struct dm_dirty_log { 22struct dm_dirty_log {
23 struct dm_dirty_log_type *type; 23 struct dm_dirty_log_type *type;
24 int (*flush_callback_fn)(struct dm_target *ti);
24 void *context; 25 void *context;
25}; 26};
26 27
@@ -136,8 +137,9 @@ int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type);
136 * type->constructor/destructor() directly. 137 * type->constructor/destructor() directly.
137 */ 138 */
138struct dm_dirty_log *dm_dirty_log_create(const char *type_name, 139struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
139 struct dm_target *ti, 140 struct dm_target *ti,
140 unsigned argc, char **argv); 141 int (*flush_callback_fn)(struct dm_target *ti),
142 unsigned argc, char **argv);
141void dm_dirty_log_destroy(struct dm_dirty_log *log); 143void dm_dirty_log_destroy(struct dm_dirty_log *log);
142 144
143#endif /* __KERNEL__ */ 145#endif /* __KERNEL__ */