Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Mikulas Patocka and committed by
Alasdair G Kergon
87a8f240 5adc78d0

+9 -5
+4 -2
drivers/md/dm-log.c
··· 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; ··· 162 161 return NULL; 163 162 } 164 163 164 + log->flush_callback_fn = flush_callback_fn; 165 165 log->type = type; 166 166 if (type->ctr(log, ti, argc, argv)) { 167 167 kfree(log);
+1 -1
drivers/md/dm-raid1.c
··· 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;
+4 -2
include/linux/dm-dirty-log.h
··· 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 ··· 137 136 * type->constructor/destructor() directly. 138 137 */ 139 138 struct dm_dirty_log *dm_dirty_log_create(const char *type_name, 140 - struct dm_target *ti, 141 - unsigned argc, char **argv); 139 + struct dm_target *ti, 140 + int (*flush_callback_fn)(struct dm_target *ti), 141 + unsigned argc, char **argv); 142 142 void dm_dirty_log_destroy(struct dm_dirty_log *log); 143 143 144 144 #endif /* __KERNEL__ */