Lines Matching refs:mirror
45 struct mirror {
76 atomic_t default_mirror; /* Default mirror */
86 struct mirror mirror[];
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)
165 return (struct mirror *) bio->bi_next;
168 static void bio_set_m(struct bio *bio, struct mirror *m)
173 static struct mirror *get_default_mirror(struct mirror_set *ms)
175 return &ms->mirror[atomic_read(&ms->default_mirror)];
178 static void set_default_mirror(struct mirror *m)
181 struct mirror *m0 = &(ms->mirror[0]);
186 static struct mirror *get_valid_mirror(struct mirror_set *ms)
188 struct mirror *m;
190 for (m = ms->mirror; m < ms->mirror + ms->nr_mirrors; m++)
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)
214 struct mirror *new;
239 DMERR("Primary mirror (%s) failed while out-of-sync: "
248 DMWARN("All sides of mirror have failed.");
261 struct mirror *m;
270 for (i = 0, m = ms->mirror; i < ms->nr_mirrors; i++, m++) {
281 fail_mirror(ms->mirror + i,
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. */
305 DMERR_LIMIT("Unable to read primary mirror during recovery");
313 * Bits correspond to devices (excluding default mirror).
314 * The default mirror cannot change during recovery.
317 if (&ms->mirror[m] == get_default_mirror(ms))
320 fail_mirror(ms->mirror + m,
333 struct mirror *m;
355 if (&ms->mirror[i] == get_default_mirror(ms))
358 m = ms->mirror + i;
379 atomic_set(&(ms->mirror[m].error_count), 0);
380 ms->mirror[m].error_type = 0;
415 static struct mirror *choose_mirror(struct mirror_set *ms, sector_t sector)
417 struct mirror *m = get_default_mirror(ms);
423 if (m-- == ms->mirror)
430 static int default_ok(struct mirror *m)
432 struct mirror *default_mirror = get_default_mirror(m->ms);
449 * remap a buffer to a particular mirror.
451 static sector_t map_sector(struct mirror *m, struct bio *bio)
458 static void map_bio(struct mirror *m, struct bio *bio)
464 static void map_region(struct dm_io_region *io, struct mirror *m,
508 struct mirror *m;
521 DMWARN_LIMIT("Read failure on mirror device %s. "
528 DMERR_LIMIT("Read failure on mirror device %s. Failing I/O.",
534 static void read_async_bio(struct mirror *m, struct bio *bio)
563 struct mirror *m;
592 * NOSYNC: increment pending, just write to the default mirror
630 fail_mirror(ms->mirror + i, DM_RAID1_WRITE_ERROR);
650 struct mirror *m;
667 for (i = 0, m = ms->mirror; i < ms->nr_mirrors; i++, m++)
671 * Use default mirror because we only need it to retrieve the reference
672 * to the mirror set in write_callback().
801 * to reconfigure the mirror, at which point the core
882 kzalloc(struct_size(ms, mirror, nr_mirrors), GFP_KERNEL);
885 ti->error = "Cannot allocate mirror context";
929 dm_put_device(ti, ms->mirror[m].dev);
937 unsigned int mirror, char **argv)
950 &ms->mirror[mirror].dev);
956 ms->mirror[mirror].ms = ms;
957 atomic_set(&(ms->mirror[mirror].error_count), 0);
958 ms->mirror[mirror].error_type = 0;
959 ms->mirror[mirror].offset = offset;
976 ti->error = "Insufficient mirror log arguments";
981 ti->error = "Invalid mirror log argument count";
988 ti->error = "Insufficient mirror log arguments";
995 ti->error = "Error creating mirror dirty log";
1052 * Construct a mirror mapping:
1088 ti->error = "Too few mirror arguments";
1099 /* Get the mirror parameter sets */
1148 ti->error = "Too many mirror arguments";
1187 struct mirror *m;
1238 struct mirror *m = NULL;
1264 * mirror in-sync.
1279 * mirror.
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)
1406 DMEMIT("%s ", ms->mirror[m].dev->name);
1407 buffer[m] = device_status_char(&(ms->mirror[m]));
1424 DMEMIT(" %s %llu", ms->mirror[m].dev->name,
1425 (unsigned long long)ms->mirror[m].offset);
1449 ret = fn(ti, ms->mirror[i].dev,
1450 ms->mirror[i].offset, ti->len, data);
1456 .name = "mirror",
1476 DMERR("Failed to register mirror target");
1495 MODULE_DESCRIPTION(DM_NAME " mirror target");