• Home
  • Raw
  • Download

Lines Matching refs:m

147 	struct mirror *m;  member
168 static void bio_set_m(struct bio *bio, struct mirror *m) in bio_set_m() argument
170 bio->bi_next = (struct bio *) m; in bio_set_m()
178 static void set_default_mirror(struct mirror *m) in set_default_mirror() argument
180 struct mirror_set *ms = m->ms; in set_default_mirror()
183 atomic_set(&ms->default_mirror, m - m0); in set_default_mirror()
188 struct mirror *m; in get_valid_mirror() local
190 for (m = ms->mirror; m < ms->mirror + ms->nr_mirrors; m++) in get_valid_mirror()
191 if (!atomic_read(&m->error_count)) in get_valid_mirror()
192 return m; in get_valid_mirror()
211 static void fail_mirror(struct mirror *m, enum dm_raid1_error error_type) in fail_mirror() argument
213 struct mirror_set *ms = m->ms; in fail_mirror()
223 atomic_inc(&m->error_count); in fail_mirror()
225 if (test_and_set_bit(error_type, &m->error_type)) in fail_mirror()
231 if (m != get_default_mirror(ms)) in fail_mirror()
240 "Reads may fail.", m->dev->name); in fail_mirror()
261 struct mirror *m; in mirror_flush() local
270 for (i = 0, m = ms->mirror; i < ms->nr_mirrors; i++, m++) { in mirror_flush()
271 io[i].bdev = m->dev->bdev; in mirror_flush()
301 int m, bit = 0; in recovery_complete() local
316 for (m = 0; m < ms->nr_mirrors; m++) { 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() local
339 m = get_default_mirror(ms); in recover()
340 from.bdev = m->dev->bdev; in recover()
341 from.sector = m->offset + dm_rh_region_to_sector(ms->rh, key); in recover()
358 m = ms->mirror + i; in recover()
359 dest->bdev = m->dev->bdev; in recover()
360 dest->sector = m->offset + dm_rh_region_to_sector(ms->rh, key); in recover()
375 unsigned int m; in reset_ms_flags() local
378 for (m = 0; m < ms->nr_mirrors; m++) { in reset_ms_flags()
379 atomic_set(&(ms->mirror[m].error_count), 0); in reset_ms_flags()
380 ms->mirror[m].error_type = 0; in reset_ms_flags()
417 struct mirror *m = get_default_mirror(ms); in choose_mirror() local
420 if (likely(!atomic_read(&m->error_count))) in choose_mirror()
421 return m; in choose_mirror()
423 if (m-- == ms->mirror) in choose_mirror()
424 m += ms->nr_mirrors; in choose_mirror()
425 } while (m != get_default_mirror(ms)); in choose_mirror()
430 static int default_ok(struct mirror *m) in default_ok() argument
432 struct mirror *default_mirror = get_default_mirror(m->ms); in default_ok()
451 static sector_t map_sector(struct mirror *m, struct bio *bio) in map_sector() argument
455 return m->offset + dm_target_offset(m->ms->ti, bio->bi_iter.bi_sector); in map_sector()
458 static void map_bio(struct mirror *m, struct bio *bio) in map_bio() argument
460 bio_set_dev(bio, m->dev->bdev); in map_bio()
461 bio->bi_iter.bi_sector = map_sector(m, bio); in map_bio()
464 static void map_region(struct dm_io_region *io, struct mirror *m, in map_region() argument
467 io->bdev = m->dev->bdev; in map_region()
468 io->sector = map_sector(m, bio); in map_region()
508 struct mirror *m; in read_callback() local
510 m = bio_get_m(bio); in read_callback()
518 fail_mirror(m, DM_RAID1_READ_ERROR); in read_callback()
520 if (likely(default_ok(m)) || mirror_available(m->ms, bio)) { in read_callback()
523 m->dev->name); in read_callback()
524 queue_bio(m->ms, bio, bio_data_dir(bio)); in read_callback()
529 m->dev->name); in read_callback()
534 static void read_async_bio(struct mirror *m, struct bio *bio) in read_async_bio() argument
544 .client = m->ms->io_client, in read_async_bio()
547 map_region(&io, m, bio); in read_async_bio()
548 bio_set_m(bio, m); in read_async_bio()
563 struct mirror *m; in do_reads() local
567 m = get_default_mirror(ms); in do_reads()
573 m = choose_mirror(ms, bio->bi_iter.bi_sector); in do_reads()
574 else if (m && atomic_read(&m->error_count)) in do_reads()
575 m = NULL; in do_reads()
577 if (likely(m)) in do_reads()
578 read_async_bio(m, bio); in do_reads()
650 struct mirror *m; in do_write() local
667 for (i = 0, m = ms->mirror; i < ms->nr_mirrors; i++, m++) in do_write()
668 map_region(dest++, m, bio); in do_write()
926 unsigned int m) in free_context() argument
928 while (m--) in free_context()
929 dm_put_device(ti, ms->mirror[m].dev); in free_context()
1066 unsigned int nr_mirrors, m, args_used; in mirror_ctr() local
1100 for (m = 0; m < nr_mirrors; m++) { in mirror_ctr()
1101 r = get_mirror(ms, ti, m, argv); in mirror_ctr()
1103 free_context(ms, ti, m); in mirror_ctr()
1187 struct mirror *m; in mirror_map() local
1221 m = choose_mirror(ms, bio->bi_iter.bi_sector); in mirror_map()
1222 if (unlikely(!m)) in mirror_map()
1226 bio_record->m = m; in mirror_map()
1228 map_bio(m, bio); in mirror_map()
1238 struct mirror *m = NULL; in mirror_end_io() local
1270 m = bio_record->m; in mirror_end_io()
1273 m->dev->name); in mirror_end_io()
1275 fail_mirror(m, DM_RAID1_READ_ERROR); in mirror_end_io()
1281 if (default_ok(m) || mirror_available(ms, bio)) { in mirror_end_io()
1381 static char device_status_char(struct mirror *m) in device_status_char() argument
1383 if (!atomic_read(&(m->error_count))) in device_status_char()
1386 return (test_bit(DM_RAID1_FLUSH_ERROR, &(m->error_type))) ? 'F' : in device_status_char()
1387 (test_bit(DM_RAID1_WRITE_ERROR, &(m->error_type))) ? 'D' : in device_status_char()
1388 (test_bit(DM_RAID1_SYNC_ERROR, &(m->error_type))) ? 'S' : in device_status_char()
1389 (test_bit(DM_RAID1_READ_ERROR, &(m->error_type))) ? 'R' : 'U'; in device_status_char()
1396 unsigned int m, sz = 0; in mirror_status() local
1405 for (m = 0; m < ms->nr_mirrors; m++) { in mirror_status()
1406 DMEMIT("%s ", ms->mirror[m].dev->name); in mirror_status()
1407 buffer[m] = device_status_char(&(ms->mirror[m])); in mirror_status()
1409 buffer[m] = '\0'; in mirror_status()
1423 for (m = 0; m < ms->nr_mirrors; 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()
1442 for (m = 0; m < ms->nr_mirrors; m++) { in mirror_status()
1443 DMEMIT(",mirror_device_%d=%s", m, ms->mirror[m].dev->name); in mirror_status()
1445 m, device_status_char(&(ms->mirror[m]))); in mirror_status()