Lines Matching full:mirror

40  * Mirror set structures.
50 struct mirror { struct
81 atomic_t default_mirror; /* Default mirror */
91 struct mirror mirror[]; member
152 struct mirror *m;
159 * Every mirror should look like this one.
164 * This is yucky. We squirrel the mirror struct away inside
168 static struct mirror *bio_get_m(struct bio *bio) in bio_get_m()
170 return (struct mirror *) bio->bi_next; in bio_get_m()
173 static void bio_set_m(struct bio *bio, struct mirror *m) in bio_set_m()
178 static struct mirror *get_default_mirror(struct mirror_set *ms) in get_default_mirror()
180 return &ms->mirror[atomic_read(&ms->default_mirror)]; in get_default_mirror()
183 static void set_default_mirror(struct mirror *m) in set_default_mirror()
186 struct mirror *m0 = &(ms->mirror[0]); in set_default_mirror()
191 static struct mirror *get_valid_mirror(struct mirror_set *ms) in get_valid_mirror()
193 struct mirror *m; in get_valid_mirror()
195 for (m = ms->mirror; m < ms->mirror + ms->nr_mirrors; m++) in get_valid_mirror()
203 * @m: mirror device to fail
212 * only if the mirror is in-sync.
216 static void fail_mirror(struct mirror *m, enum dm_raid1_error error_type) in fail_mirror()
219 struct mirror *new; in fail_mirror()
244 DMERR("Primary mirror (%s) failed while out-of-sync: Reads may fail.", in fail_mirror()
253 DMWARN("All sides of mirror have failed."); in fail_mirror()
266 struct mirror *m; in mirror_flush()
274 for (i = 0, m = ms->mirror; i < ms->nr_mirrors; i++, m++) { in mirror_flush()
285 fail_mirror(ms->mirror + i, in mirror_flush()
297 * When a mirror is first activated we may find that some regions
299 * recopying from the default mirror to all the others.
310 /* Read error means the failure of default mirror. */ in recovery_complete()
311 DMERR_LIMIT("Unable to read primary mirror during recovery"); in recovery_complete()
319 * Bits correspond to devices (excluding default mirror). in recovery_complete()
320 * The default mirror cannot change during recovery. in recovery_complete()
323 if (&ms->mirror[m] == get_default_mirror(ms)) in recovery_complete()
326 fail_mirror(ms->mirror + m, in recovery_complete()
339 struct mirror *m; in recover()
361 if (&ms->mirror[i] == get_default_mirror(ms)) in recover()
364 m = ms->mirror + i; in recover()
385 atomic_set(&(ms->mirror[m].error_count), 0); in reset_ms_flags()
386 ms->mirror[m].error_type = 0; in reset_ms_flags()
423 static struct mirror *choose_mirror(struct mirror_set *ms, sector_t sector) in choose_mirror()
425 struct mirror *m = get_default_mirror(ms); in choose_mirror()
431 if (m-- == ms->mirror) in choose_mirror()
438 static int default_ok(struct mirror *m) in default_ok()
440 struct mirror *default_mirror = get_default_mirror(m->ms); in default_ok()
457 * remap a buffer to a particular mirror.
459 static sector_t map_sector(struct mirror *m, struct bio *bio) in map_sector()
466 static void map_bio(struct mirror *m, struct bio *bio) in map_bio()
472 static void map_region(struct dm_io_region *io, struct mirror *m, in map_region()
518 struct mirror *m; in read_callback()
531 DMWARN_LIMIT("Read failure on mirror device %s. Trying alternative device.", in read_callback()
537 DMERR_LIMIT("Read failure on mirror device %s. Failing I/O.", in read_callback()
543 static void read_async_bio(struct mirror *m, struct bio *bio) in read_async_bio()
571 struct mirror *m; in do_reads()
601 * NOSYNC: increment pending, just write to the default mirror
638 fail_mirror(ms->mirror + i, DM_RAID1_WRITE_ERROR); in write_callback()
658 struct mirror *m; in do_write()
675 for (i = 0, m = ms->mirror; i < ms->nr_mirrors; i++, m++) in do_write()
679 * Use default mirror because we only need it to retrieve the reference in do_write()
680 * to the mirror set in write_callback(). in do_write()
809 * to reconfigure the mirror, at which point the core in do_failures()
894 kzalloc(struct_size(ms, mirror, nr_mirrors), GFP_KERNEL); in alloc_context()
897 ti->error = "Cannot allocate mirror context"; in alloc_context()
941 dm_put_device(ti, ms->mirror[m].dev); in free_context()
949 unsigned int mirror, char **argv) in get_mirror() argument
962 &ms->mirror[mirror].dev); in get_mirror()
968 ms->mirror[mirror].ms = ms; in get_mirror()
969 atomic_set(&(ms->mirror[mirror].error_count), 0); in get_mirror()
970 ms->mirror[mirror].error_type = 0; in get_mirror()
971 ms->mirror[mirror].offset = offset; in get_mirror()
988 ti->error = "Insufficient mirror log arguments"; in create_dirty_log()
993 ti->error = "Invalid mirror log argument count"; in create_dirty_log()
1000 ti->error = "Insufficient mirror log arguments"; in create_dirty_log()
1007 ti->error = "Error creating mirror dirty log"; in create_dirty_log()
1064 * Construct a mirror mapping:
1100 ti->error = "Too few mirror arguments"; in mirror_ctr()
1111 /* Get the mirror parameter sets */ in mirror_ctr()
1160 ti->error = "Too many mirror arguments"; in mirror_ctr()
1194 * Mirror mapping function
1199 struct mirror *m; in mirror_map()
1250 struct mirror *m = NULL; in mirror_end_io()
1276 * mirror in-sync. in mirror_end_io()
1278 DMERR_LIMIT("Mirror read failed."); in mirror_end_io()
1284 DMERR("Mirror read failed from %s. Trying alternative device.", in mirror_end_io()
1291 * mirror. in mirror_end_io()
1382 * @m: mirror device/leg we want the status of
1387 * D => Dead - A write failure occurred leaving mirror out-of-sync
1388 * S => Sync - A sychronization failure occurred, mirror out-of-sync
1389 * R => Read - A read failure occurred, mirror data unaffected
1393 static char device_status_char(struct mirror *m) in device_status_char()
1418 DMEMIT("%s ", ms->mirror[m].dev->name); in mirror_status()
1419 buffer[m] = device_status_char(&(ms->mirror[m])); in mirror_status()
1436 DMEMIT(" %s %llu", ms->mirror[m].dev->name, in mirror_status()
1437 (unsigned long long)ms->mirror[m].offset); in mirror_status()
1455 DMEMIT(",mirror_device_%d=%s", m, ms->mirror[m].dev->name); in mirror_status()
1457 m, device_status_char(&(ms->mirror[m]))); in mirror_status()
1478 ret = fn(ti, ms->mirror[i].dev, in mirror_iterate_devices()
1479 ms->mirror[i].offset, ti->len, data); in mirror_iterate_devices()
1485 .name = "mirror",
1528 MODULE_DESCRIPTION(DM_NAME " mirror target");