Lines Matching refs:fbio

166 static int next_repair_mirror(struct btrfs_failed_bio *fbio, int cur_mirror)  in next_repair_mirror()  argument
168 if (cur_mirror == fbio->num_copies) in next_repair_mirror()
169 return cur_mirror + 1 - fbio->num_copies; in next_repair_mirror()
173 static int prev_repair_mirror(struct btrfs_failed_bio *fbio, int cur_mirror) in prev_repair_mirror() argument
176 return fbio->num_copies; in prev_repair_mirror()
180 static void btrfs_repair_done(struct btrfs_failed_bio *fbio) in btrfs_repair_done() argument
182 if (atomic_dec_and_test(&fbio->repair_count)) { in btrfs_repair_done()
183 btrfs_orig_bbio_end_io(fbio->bbio); in btrfs_repair_done()
184 mempool_free(fbio, &btrfs_failed_bio_pool); in btrfs_repair_done()
191 struct btrfs_failed_bio *fbio = repair_bbio->private; in btrfs_end_repair_bio() local
202 mirror = next_repair_mirror(fbio, mirror); in btrfs_end_repair_bio()
203 if (mirror == fbio->bbio->mirror_num) { in btrfs_end_repair_bio()
205 fbio->bbio->bio.bi_status = BLK_STS_IOERR; in btrfs_end_repair_bio()
214 mirror = prev_repair_mirror(fbio, mirror); in btrfs_end_repair_bio()
219 } while (mirror != fbio->bbio->mirror_num); in btrfs_end_repair_bio()
222 btrfs_repair_done(fbio); in btrfs_end_repair_bio()
236 struct btrfs_failed_bio *fbio) in repair_one_sector() argument
254 return fbio; in repair_one_sector()
257 if (!fbio) { in repair_one_sector()
258 fbio = mempool_alloc(&btrfs_failed_bio_pool, GFP_NOFS); in repair_one_sector()
259 fbio->bbio = failed_bbio; in repair_one_sector()
260 fbio->num_copies = num_copies; in repair_one_sector()
261 atomic_set(&fbio->repair_count, 1); in repair_one_sector()
264 atomic_inc(&fbio->repair_count); in repair_one_sector()
272 btrfs_bio_init(repair_bbio, fs_info, NULL, fbio); in repair_one_sector()
276 mirror = next_repair_mirror(fbio, failed_bbio->mirror_num); in repair_one_sector()
279 return fbio; in repair_one_sector()
289 struct btrfs_failed_bio *fbio = NULL; in btrfs_check_read_bio() local
312 fbio = repair_one_sector(bbio, offset, &bv, fbio); in btrfs_check_read_bio()
321 if (fbio) in btrfs_check_read_bio()
322 btrfs_repair_done(fbio); in btrfs_check_read_bio()