• Home
  • Raw
  • Download

Lines Matching full:mirror

40  * Mirror set structures.
50 struct mirror { struct
81 atomic_t default_mirror; /* Default mirror */
91 struct mirror mirror[]; member
151 struct mirror *m;
158 * Every mirror should look like this one.
163 * This is yucky. We squirrel the mirror struct away inside
167 static struct mirror *bio_get_m(struct bio *bio) in bio_get_m()
169 return (struct mirror *) bio->bi_next; in bio_get_m()
172 static void bio_set_m(struct bio *bio, struct mirror *m) in bio_set_m()
177 static struct mirror *get_default_mirror(struct mirror_set *ms) in get_default_mirror()
179 return &ms->mirror[atomic_read(&ms->default_mirror)]; in get_default_mirror()
182 static void set_default_mirror(struct mirror *m) in set_default_mirror()
185 struct mirror *m0 = &(ms->mirror[0]); in set_default_mirror()
190 static struct mirror *get_valid_mirror(struct mirror_set *ms) in get_valid_mirror()
192 struct mirror *m; in get_valid_mirror()
194 for (m = ms->mirror; m < ms->mirror + ms->nr_mirrors; m++) in get_valid_mirror()
202 * @m: mirror device to fail
211 * only if the mirror is in-sync.
215 static void fail_mirror(struct mirror *m, enum dm_raid1_error error_type) in fail_mirror()
218 struct mirror *new; in fail_mirror()
243 DMERR("Primary mirror (%s) failed while out-of-sync: Reads may fail.", in fail_mirror()
252 DMWARN("All sides of mirror have failed."); in fail_mirror()
265 struct mirror *m; in mirror_flush()
273 for (i = 0, m = ms->mirror; i < ms->nr_mirrors; i++, m++) { in mirror_flush()
284 fail_mirror(ms->mirror + i, in mirror_flush()
296 * When a mirror is first activated we may find that some regions
298 * recopying from the default mirror to all the others.
309 /* Read error means the failure of default mirror. */ in recovery_complete()
310 DMERR_LIMIT("Unable to read primary mirror during recovery"); in recovery_complete()
318 * Bits correspond to devices (excluding default mirror). in recovery_complete()
319 * The default mirror cannot change during recovery. in recovery_complete()
322 if (&ms->mirror[m] == get_default_mirror(ms)) in recovery_complete()
325 fail_mirror(ms->mirror + m, in recovery_complete()
338 struct mirror *m; in recover()
360 if (&ms->mirror[i] == get_default_mirror(ms)) in recover()
363 m = ms->mirror + i; in recover()
384 atomic_set(&(ms->mirror[m].error_count), 0); in reset_ms_flags()
385 ms->mirror[m].error_type = 0; in reset_ms_flags()
422 static struct mirror *choose_mirror(struct mirror_set *ms, sector_t sector) in choose_mirror()
424 struct mirror *m = get_default_mirror(ms); in choose_mirror()
430 if (m-- == ms->mirror) in choose_mirror()
437 static int default_ok(struct mirror *m) in default_ok()
439 struct mirror *default_mirror = get_default_mirror(m->ms); in default_ok()
456 * remap a buffer to a particular mirror.
458 static sector_t map_sector(struct mirror *m, struct bio *bio) in map_sector()
465 static void map_bio(struct mirror *m, struct bio *bio) in map_bio()
471 static void map_region(struct dm_io_region *io, struct mirror *m, in map_region()
517 struct mirror *m; in read_callback()
530 DMWARN_LIMIT("Read failure on mirror device %s. Trying alternative device.", in read_callback()
536 DMERR_LIMIT("Read failure on mirror device %s. Failing I/O.", in read_callback()
542 static void read_async_bio(struct mirror *m, struct bio *bio) in read_async_bio()
570 struct mirror *m; in do_reads()
600 * NOSYNC: increment pending, just write to the default mirror
637 fail_mirror(ms->mirror + i, DM_RAID1_WRITE_ERROR); in write_callback()
657 struct mirror *m; in do_write()
674 for (i = 0, m = ms->mirror; i < ms->nr_mirrors; i++, m++) in do_write()
678 * Use default mirror because we only need it to retrieve the reference in do_write()
679 * to the mirror set in write_callback(). in do_write()
808 * to reconfigure the mirror, at which point the core in do_failures()
893 kzalloc(struct_size(ms, mirror, nr_mirrors), GFP_KERNEL); in alloc_context()
896 ti->error = "Cannot allocate mirror context"; in alloc_context()
940 dm_put_device(ti, ms->mirror[m].dev); in free_context()
948 unsigned int mirror, char **argv) in get_mirror() argument
961 &ms->mirror[mirror].dev); in get_mirror()
967 ms->mirror[mirror].ms = ms; in get_mirror()
968 atomic_set(&(ms->mirror[mirror].error_count), 0); in get_mirror()
969 ms->mirror[mirror].error_type = 0; in get_mirror()
970 ms->mirror[mirror].offset = offset; in get_mirror()
987 ti->error = "Insufficient mirror log arguments"; in create_dirty_log()
992 ti->error = "Invalid mirror log argument count"; in create_dirty_log()
999 ti->error = "Insufficient mirror log arguments"; in create_dirty_log()
1006 ti->error = "Error creating mirror dirty log"; in create_dirty_log()
1063 * Construct a mirror mapping:
1099 ti->error = "Too few mirror arguments"; in mirror_ctr()
1110 /* Get the mirror parameter sets */ in mirror_ctr()
1159 ti->error = "Too many mirror arguments"; in mirror_ctr()
1193 * Mirror mapping function
1198 struct mirror *m; in mirror_map()
1249 struct mirror *m = NULL; in mirror_end_io()
1275 * mirror in-sync. in mirror_end_io()
1277 DMERR_LIMIT("Mirror read failed."); in mirror_end_io()
1283 DMERR("Mirror read failed from %s. Trying alternative device.", in mirror_end_io()
1290 * mirror. in mirror_end_io()
1381 * @m: mirror device/leg we want the status of
1386 * D => Dead - A write failure occurred leaving mirror out-of-sync
1387 * S => Sync - A sychronization failure occurred, mirror out-of-sync
1388 * R => Read - A read failure occurred, mirror data unaffected
1392 static char device_status_char(struct mirror *m) in device_status_char()
1417 DMEMIT("%s ", ms->mirror[m].dev->name); in mirror_status()
1418 buffer[m] = device_status_char(&(ms->mirror[m])); in mirror_status()
1435 DMEMIT(" %s %llu", ms->mirror[m].dev->name, in mirror_status()
1436 (unsigned long long)ms->mirror[m].offset); in mirror_status()
1454 DMEMIT(",mirror_device_%d=%s", m, ms->mirror[m].dev->name); in mirror_status()
1456 m, device_status_char(&(ms->mirror[m]))); in mirror_status()
1477 ret = fn(ti, ms->mirror[i].dev, in mirror_iterate_devices()
1478 ms->mirror[i].offset, ti->len, data); in mirror_iterate_devices()
1484 .name = "mirror",
1527 MODULE_DESCRIPTION(DM_NAME " mirror target");