Commit 87a8f240e9bcf025ba45e4563c842b0d59c5e8ef

Authored by Mikulas Patocka
Committed by Alasdair G Kergon
1 parent 5adc78d0d2

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>

Showing 3 changed files with 9 additions and 5 deletions Side-by-side Diff

... ... @@ -145,8 +145,9 @@
145 145 EXPORT_SYMBOL(dm_dirty_log_type_unregister);
146 146  
147 147 struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
148   - struct dm_target *ti,
149   - unsigned int argc, char **argv)
  148 + struct dm_target *ti,
  149 + int (*flush_callback_fn)(struct dm_target *ti),
  150 + unsigned int argc, char **argv)
150 151 {
151 152 struct dm_dirty_log_type *type;
152 153 struct dm_dirty_log *log;
... ... @@ -161,6 +162,7 @@
161 162 return NULL;
162 163 }
163 164  
  165 + log->flush_callback_fn = flush_callback_fn;
164 166 log->type = type;
165 167 if (type->ctr(log, ti, argc, argv)) {
166 168 kfree(log);
drivers/md/dm-raid1.c
... ... @@ -896,7 +896,7 @@
896 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 900 if (!dl) {
901 901 ti->error = "Error creating mirror dirty log";
902 902 return NULL;
include/linux/dm-dirty-log.h
... ... @@ -21,6 +21,7 @@
21 21  
22 22 struct dm_dirty_log {
23 23 struct dm_dirty_log_type *type;
  24 + int (*flush_callback_fn)(struct dm_target *ti);
24 25 void *context;
25 26 };
26 27  
... ... @@ -136,8 +137,9 @@
136 137 * type->constructor/destructor() directly.
137 138 */
138 139 struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
139   - struct dm_target *ti,
140   - unsigned argc, char **argv);
  140 + struct dm_target *ti,
  141 + int (*flush_callback_fn)(struct dm_target *ti),
  142 + unsigned argc, char **argv);
141 143 void dm_dirty_log_destroy(struct dm_dirty_log *log);
142 144  
143 145 #endif /* __KERNEL__ */