Lines Matching defs:log

13 #include <linux/dm-dirty-log.h>
17 #define DM_MSG_PREFIX "dirty region log"
55 * Log modules are named "dm-log-" followed by the 'type_name'.
57 * This function will first try the module "dm-log-<type_name>",
61 * 'dm-log-clustered-disk' then 'dm-log-clustered'.
79 DMWARN("No memory left to attempt log module load for \"%s\"",
84 while (request_module("dm-log-%s", type_name_dup) ||
153 struct dm_dirty_log *log;
155 log = kmalloc(sizeof(*log), GFP_KERNEL);
156 if (!log)
161 kfree(log);
165 log->flush_callback_fn = flush_callback_fn;
166 log->type = type;
167 if (type->ctr(log, ti, argc, argv)) {
168 kfree(log);
173 return log;
177 void dm_dirty_log_destroy(struct dm_dirty_log *log)
179 log->type->dtr(log);
180 put_type(log->type);
181 kfree(log);
243 * Disk log fields
316 static int read_header(struct log_c *log)
320 r = rw_header(log, REQ_OP_READ);
324 header_from_disk(&log->header, log->disk_header);
326 /* New log required? */
327 if (log->sync != DEFAULTSYNC || log->header.magic != MIRROR_MAGIC) {
328 log->header.magic = MIRROR_MAGIC;
329 log->header.version = MIRROR_DISK_VERSION;
330 log->header.nr_regions = 0;
334 if (log->header.version == 1)
335 log->header.version = 2;
338 if (log->header.version != MIRROR_DISK_VERSION) {
339 DMWARN("incompatible disk log version");
358 * core log constructor/destructor
363 static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
377 DMWARN("wrong number of arguments to dirty region log");
388 "dirty region log: %s", argv[1]);
403 DMWARN("couldn't allocate core log");
424 * Disk log?
450 DMWARN("log device %s too small: need %llu bytes",
470 DMWARN("couldn't allocate disk log buffer");
510 log->context = lc;
515 static int core_ctr(struct dm_dirty_log *log, struct dm_target *ti,
518 return create_log_context(log, ti, argc, argv, NULL);
528 static void core_dtr(struct dm_dirty_log *log)
530 struct log_c *lc = (struct log_c *) log->context;
537 * disk log constructor/destructor
541 static int disk_ctr(struct dm_dirty_log *log, struct dm_target *ti,
548 DMWARN("wrong number of arguments to disk dirty region log");
556 r = create_log_context(log, ti, argc - 1, argv + 1, dev);
565 static void disk_dtr(struct dm_dirty_log *log)
567 struct log_c *lc = (struct log_c *) log->context;
584 static int disk_resume(struct dm_dirty_log *log)
588 struct log_c *lc = (struct log_c *) log->context;
594 DMWARN("%s: Failed to read header on dirty region log device",
598 * If the log device cannot be read, we must assume
640 DMWARN("%s: Failed to write header on dirty region log device",
648 static uint32_t core_get_region_size(struct dm_dirty_log *log)
650 struct log_c *lc = (struct log_c *) log->context;
654 static int core_resume(struct dm_dirty_log *log)
656 struct log_c *lc = (struct log_c *) log->context;
661 static int core_is_clean(struct dm_dirty_log *log, region_t region)
663 struct log_c *lc = (struct log_c *) log->context;
667 static int core_in_sync(struct dm_dirty_log *log, region_t region, int block)
669 struct log_c *lc = (struct log_c *) log->context;
673 static int core_flush(struct dm_dirty_log *log)
679 static int disk_flush(struct dm_dirty_log *log)
682 struct log_c *lc = log->context;
684 /* only write if the log has changed */
688 if (lc->touched_cleaned && log->flush_callback_fn &&
689 log->flush_callback_fn(lc->ti)) {
693 * re-reading the log off disk). So mark all of them
719 static void core_mark_region(struct dm_dirty_log *log, region_t region)
721 struct log_c *lc = (struct log_c *) log->context;
725 static void core_clear_region(struct dm_dirty_log *log, region_t region)
727 struct log_c *lc = (struct log_c *) log->context;
732 static int core_get_resync_work(struct dm_dirty_log *log, region_t *region)
734 struct log_c *lc = (struct log_c *) log->context;
754 static void core_set_region_sync(struct dm_dirty_log *log, region_t region,
757 struct log_c *lc = (struct log_c *) log->context;
769 static region_t core_get_sync_count(struct dm_dirty_log *log)
771 struct log_c *lc = (struct log_c *) log->context;
780 static int core_status(struct dm_dirty_log *log, status_type_t status,
784 struct log_c *lc = log->context;
788 DMEMIT("1 %s", log->type->name);
792 DMEMIT("%s %u %u ", log->type->name,
800 static int disk_status(struct dm_dirty_log *log, status_type_t status,
804 struct log_c *lc = log->context;
808 DMEMIT("3 %s %s %c", log->type->name, lc->log_dev->name,
815 DMEMIT("%s %u %s %u ", log->type->name,
867 DMWARN("couldn't register core log");
887 MODULE_DESCRIPTION(DM_NAME " dirty region log");