Lines Matching refs:log

14 #include <linux/dm-dirty-log.h>
18 #define DM_MSG_PREFIX "dirty region log"
56 * Log modules are named "dm-log-" followed by the 'type_name'.
58 * This function will first try the module "dm-log-<type_name>",
62 * 'dm-log-clustered-disk' then 'dm-log-clustered'.
80 DMWARN("No memory left to attempt log module load for \"%s\"",
85 while (request_module("dm-log-%s", type_name_dup) ||
154 struct dm_dirty_log *log;
156 log = kmalloc(sizeof(*log), GFP_KERNEL);
157 if (!log)
162 kfree(log);
166 log->flush_callback_fn = flush_callback_fn;
167 log->type = type;
168 if (type->ctr(log, ti, argc, argv)) {
169 kfree(log);
174 return log;
178 void dm_dirty_log_destroy(struct dm_dirty_log *log)
180 log->type->dtr(log);
181 put_type(log->type);
182 kfree(log);
246 * Disk log fields
319 static int read_header(struct log_c *log)
323 r = rw_header(log, REQ_OP_READ);
327 header_from_disk(&log->header, log->disk_header);
329 /* New log required? */
330 if (log->sync != DEFAULTSYNC || log->header.magic != MIRROR_MAGIC) {
331 log->header.magic = MIRROR_MAGIC;
332 log->header.version = MIRROR_DISK_VERSION;
333 log->header.nr_regions = 0;
337 if (log->header.version == 1)
338 log->header.version = 2;
341 if (log->header.version != MIRROR_DISK_VERSION) {
342 DMWARN("incompatible disk log version");
362 * core log constructor/destructor
368 static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
382 DMWARN("wrong number of arguments to dirty region log");
392 DMWARN("unrecognised sync argument to dirty region log: %s", argv[1]);
407 DMWARN("couldn't allocate core log");
428 * Disk log?
453 DMWARN("log device %s too small: need %llu bytes",
473 DMWARN("couldn't allocate disk log buffer");
513 log->context = lc;
518 static int core_ctr(struct dm_dirty_log *log, struct dm_target *ti,
521 return create_log_context(log, ti, argc, argv, NULL);
531 static void core_dtr(struct dm_dirty_log *log)
533 struct log_c *lc = log->context;
541 * disk log constructor/destructor
546 static int disk_ctr(struct dm_dirty_log *log, struct dm_target *ti,
553 DMWARN("wrong number of arguments to disk dirty region log");
561 r = create_log_context(log, ti, argc - 1, argv + 1, dev);
570 static void disk_dtr(struct dm_dirty_log *log)
572 struct log_c *lc = log->context;
589 static int disk_resume(struct dm_dirty_log *log)
593 struct log_c *lc = log->context;
599 DMWARN("%s: Failed to read header on dirty region log device",
603 * If the log device cannot be read, we must assume
645 DMWARN("%s: Failed to write header on dirty region log device",
653 static uint32_t core_get_region_size(struct dm_dirty_log *log)
655 struct log_c *lc = log->context;
660 static int core_resume(struct dm_dirty_log *log)
662 struct log_c *lc = log->context;
668 static int core_is_clean(struct dm_dirty_log *log, region_t region)
670 struct log_c *lc = log->context;
675 static int core_in_sync(struct dm_dirty_log *log, region_t region, int block)
677 struct log_c *lc = log->context;
682 static int core_flush(struct dm_dirty_log *log)
688 static int disk_flush(struct dm_dirty_log *log)
691 struct log_c *lc = log->context;
693 /* only write if the log has changed */
697 if (lc->touched_cleaned && log->flush_callback_fn &&
698 log->flush_callback_fn(lc->ti)) {
702 * re-reading the log off disk). So mark all of them
728 static void core_mark_region(struct dm_dirty_log *log, region_t region)
730 struct log_c *lc = log->context;
735 static void core_clear_region(struct dm_dirty_log *log, region_t region)
737 struct log_c *lc = log->context;
743 static int core_get_resync_work(struct dm_dirty_log *log, region_t *region)
745 struct log_c *lc = log->context;
765 static void core_set_region_sync(struct dm_dirty_log *log, region_t region,
768 struct log_c *lc = log->context;
780 static region_t core_get_sync_count(struct dm_dirty_log *log)
782 struct log_c *lc = log->context;
793 static int core_status(struct dm_dirty_log *log, status_type_t status,
797 struct log_c *lc = log->context;
801 DMEMIT("1 %s", log->type->name);
805 DMEMIT("%s %u %u ", log->type->name,
818 static int disk_status(struct dm_dirty_log *log, status_type_t status,
822 struct log_c *lc = log->context;
826 DMEMIT("3 %s %s %c", log->type->name, lc->log_dev->name,
833 DMEMIT("%s %u %s %u ", log->type->name,
890 DMWARN("couldn't register core log");
910 MODULE_DESCRIPTION(DM_NAME " dirty region log");