• Home
  • Raw
  • Download

Lines Matching full:mirror

36  * Mirror set structures.
45 struct mirror { struct
76 atomic_t default_mirror; /* Default mirror */
86 struct mirror mirror[]; member
147 struct mirror *m;
154 * Every mirror should look like this one.
159 * This is yucky. We squirrel the mirror struct away inside
163 static struct mirror *bio_get_m(struct bio *bio) in bio_get_m()
165 return (struct mirror *) bio->bi_next; in bio_get_m()
168 static void bio_set_m(struct bio *bio, struct mirror *m) in bio_set_m()
173 static struct mirror *get_default_mirror(struct mirror_set *ms) in get_default_mirror()
175 return &ms->mirror[atomic_read(&ms->default_mirror)]; in get_default_mirror()
178 static void set_default_mirror(struct mirror *m) in set_default_mirror()
181 struct mirror *m0 = &(ms->mirror[0]); in set_default_mirror()
186 static struct mirror *get_valid_mirror(struct mirror_set *ms) in get_valid_mirror()
188 struct mirror *m; in get_valid_mirror()
190 for (m = ms->mirror; m < ms->mirror + ms->nr_mirrors; m++) in get_valid_mirror()
198 * @m: mirror device to fail
207 * only if the mirror is in-sync.
211 static void fail_mirror(struct mirror *m, enum dm_raid1_error error_type) in fail_mirror()
214 struct mirror *new; in fail_mirror()
239 DMERR("Primary mirror (%s) failed while out-of-sync: " in fail_mirror()
248 DMWARN("All sides of mirror have failed."); in fail_mirror()
261 struct mirror *m; in mirror_flush()
270 for (i = 0, m = ms->mirror; i < ms->nr_mirrors; i++, m++) { in mirror_flush()
281 fail_mirror(ms->mirror + i, in mirror_flush()
292 * When a mirror is first activated we may find that some regions
294 * recopying from the default mirror to all the others.
304 /* Read error means the failure of default mirror. */ in recovery_complete()
305 DMERR_LIMIT("Unable to read primary mirror during recovery"); in recovery_complete()
313 * Bits correspond to devices (excluding default mirror). in recovery_complete()
314 * The default mirror cannot change during recovery. in recovery_complete()
317 if (&ms->mirror[m] == get_default_mirror(ms)) in recovery_complete()
320 fail_mirror(ms->mirror + m, in recovery_complete()
333 struct mirror *m; in recover()
355 if (&ms->mirror[i] == get_default_mirror(ms)) in recover()
358 m = ms->mirror + i; in recover()
379 atomic_set(&(ms->mirror[m].error_count), 0); in reset_ms_flags()
380 ms->mirror[m].error_type = 0; in reset_ms_flags()
415 static struct mirror *choose_mirror(struct mirror_set *ms, sector_t sector) in choose_mirror()
417 struct mirror *m = get_default_mirror(ms); in choose_mirror()
423 if (m-- == ms->mirror) in choose_mirror()
430 static int default_ok(struct mirror *m) in default_ok()
432 struct mirror *default_mirror = get_default_mirror(m->ms); in default_ok()
449 * remap a buffer to a particular mirror.
451 static sector_t map_sector(struct mirror *m, struct bio *bio) in map_sector()
458 static void map_bio(struct mirror *m, struct bio *bio) in map_bio()
464 static void map_region(struct dm_io_region *io, struct mirror *m, in map_region()
508 struct mirror *m; in read_callback()
521 DMWARN_LIMIT("Read failure on mirror device %s. " in read_callback()
528 DMERR_LIMIT("Read failure on mirror device %s. Failing I/O.", in read_callback()
534 static void read_async_bio(struct mirror *m, struct bio *bio) in read_async_bio()
563 struct mirror *m; in do_reads()
592 * NOSYNC: increment pending, just write to the default mirror
630 fail_mirror(ms->mirror + i, DM_RAID1_WRITE_ERROR); in write_callback()
650 struct mirror *m; in do_write()
667 for (i = 0, m = ms->mirror; i < ms->nr_mirrors; i++, m++) in do_write()
671 * Use default mirror because we only need it to retrieve the reference in do_write()
672 * to the mirror set in write_callback(). in do_write()
801 * to reconfigure the mirror, at which point the core in do_failures()
882 kzalloc(struct_size(ms, mirror, nr_mirrors), GFP_KERNEL); in alloc_context()
885 ti->error = "Cannot allocate mirror context"; in alloc_context()
929 dm_put_device(ti, ms->mirror[m].dev); in free_context()
937 unsigned int mirror, char **argv) in get_mirror() argument
950 &ms->mirror[mirror].dev); in get_mirror()
956 ms->mirror[mirror].ms = ms; in get_mirror()
957 atomic_set(&(ms->mirror[mirror].error_count), 0); in get_mirror()
958 ms->mirror[mirror].error_type = 0; in get_mirror()
959 ms->mirror[mirror].offset = offset; in get_mirror()
976 ti->error = "Insufficient mirror log arguments"; in create_dirty_log()
981 ti->error = "Invalid mirror log argument count"; in create_dirty_log()
988 ti->error = "Insufficient mirror log arguments"; in create_dirty_log()
995 ti->error = "Error creating mirror dirty log"; in create_dirty_log()
1052 * Construct a mirror mapping:
1088 ti->error = "Too few mirror arguments"; in mirror_ctr()
1099 /* Get the mirror parameter sets */ in mirror_ctr()
1148 ti->error = "Too many mirror arguments"; in mirror_ctr()
1182 * Mirror mapping function
1187 struct mirror *m; in mirror_map()
1238 struct mirror *m = NULL; in mirror_end_io()
1264 * mirror in-sync. in mirror_end_io()
1266 DMERR_LIMIT("Mirror read failed."); in mirror_end_io()
1272 DMERR("Mirror read failed from %s. Trying alternative device.", in mirror_end_io()
1279 * mirror. in mirror_end_io()
1370 * @m: mirror device/leg we want the status of
1375 * D => Dead - A write failure occurred leaving mirror out-of-sync
1376 * S => Sync - A sychronization failure occurred, mirror out-of-sync
1377 * R => Read - A read failure occurred, mirror data unaffected
1381 static char device_status_char(struct mirror *m) in device_status_char()
1406 DMEMIT("%s ", ms->mirror[m].dev->name); in mirror_status()
1407 buffer[m] = device_status_char(&(ms->mirror[m])); in mirror_status()
1424 DMEMIT(" %s %llu", ms->mirror[m].dev->name, in mirror_status()
1425 (unsigned long long)ms->mirror[m].offset); in mirror_status()
1449 ret = fn(ti, ms->mirror[i].dev, in mirror_iterate_devices()
1450 ms->mirror[i].offset, ti->len, data); in mirror_iterate_devices()
1456 .name = "mirror",
1476 DMERR("Failed to register mirror target"); in dm_mirror_init()
1495 MODULE_DESCRIPTION(DM_NAME " mirror target");