Lines Matching defs:bio

8 #include <linux/bio.h>
421 * Preallocate a bio that's always going to be used for flushing device
6001 * particular bio can get before it straddles a stripe.
6360 static inline void btrfs_end_bbio(struct btrfs_bio *bbio, struct bio *bio)
6362 bio->bi_private = bbio->private;
6363 bio->bi_end_io = bbio->end_io;
6364 bio_endio(bio);
6369 static void btrfs_end_bio(struct bio *bio)
6371 struct btrfs_bio *bbio = bio->bi_private;
6374 if (bio->bi_status) {
6376 if (bio->bi_status == BLK_STS_IOERR ||
6377 bio->bi_status == BLK_STS_TARGET) {
6378 struct btrfs_device *dev = btrfs_io_bio(bio)->device;
6381 if (bio_op(bio) == REQ_OP_WRITE)
6384 else if (!(bio->bi_opf & REQ_RAHEAD))
6387 if (bio->bi_opf & REQ_PREFLUSH)
6393 if (bio == bbio->orig_bio)
6400 bio_put(bio);
6401 bio = bbio->orig_bio;
6404 btrfs_io_bio(bio)->mirror_num = bbio->mirror_num;
6406 * beyond the tolerance of the btrfs bio
6409 bio->bi_status = BLK_STS_IOERR;
6412 * this bio is actually up to date, we didn't
6415 bio->bi_status = BLK_STS_OK;
6418 btrfs_end_bbio(bbio, bio);
6420 bio_put(bio);
6424 static void submit_stripe_bio(struct btrfs_bio *bbio, struct bio *bio,
6429 bio->bi_private = bbio;
6430 btrfs_io_bio(bio)->device = dev;
6431 bio->bi_end_io = btrfs_end_bio;
6432 bio->bi_iter.bi_sector = physical >> 9;
6435 bio_op(bio), bio->bi_opf, (u64)bio->bi_iter.bi_sector,
6437 dev->devid, bio->bi_iter.bi_size);
6438 bio_set_dev(bio, dev->bdev);
6442 btrfsic_submit_bio(bio);
6445 static void bbio_error(struct btrfs_bio *bbio, struct bio *bio, u64 logical)
6449 /* Should be the original bio. */
6450 WARN_ON(bio != bbio->orig_bio);
6452 btrfs_io_bio(bio)->mirror_num = bbio->mirror_num;
6453 bio->bi_iter.bi_sector = logical >> 9;
6455 bio->bi_status = BLK_STS_IOERR;
6457 bio->bi_status = BLK_STS_OK;
6458 btrfs_end_bbio(bbio, bio);
6462 blk_status_t btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
6466 struct bio *first_bio = bio;
6467 u64 logical = (u64)bio->bi_iter.bi_sector << 9;
6475 length = bio->bi_iter.bi_size;
6479 ret = __btrfs_map_block(fs_info, btrfs_op(bio), logical,
6494 ((bio_op(bio) == REQ_OP_WRITE) || (mirror_num > 1))) {
6497 if (bio_op(bio) == REQ_OP_WRITE) {
6498 ret = raid56_parity_write(fs_info, bio, bbio,
6501 ret = raid56_parity_recover(fs_info, bio, bbio,
6511 "mapping failed logical %llu bio len %llu len %llu",
6527 bio = btrfs_bio_clone(first_bio);
6529 bio = first_bio;
6531 submit_stripe_bio(bbio, bio, bbio->stripes[dev_nr].physical, dev);