Lines Matching refs:clone

83 	struct request *orig, clone;
697 static void end_clone_bio(struct bio *clone, int error)
699 struct dm_rq_clone_bio_info *info = clone->bi_private;
704 bio_put(clone);
709 * Once error occurred, just let clone->end_io() handle
739 * the original request before the clone, and break the ordering.
766 static void free_rq_clone(struct request *clone)
768 struct dm_rq_target_io *tio = clone->end_io_data;
770 blk_rq_unprep_clone(clone);
775 * Complete the clone and the original request.
778 static void dm_end_request(struct request *clone, int error)
780 int rw = rq_data_dir(clone);
781 struct dm_rq_target_io *tio = clone->end_io_data;
786 rq->errors = clone->errors;
787 rq->resid_len = clone->resid_len;
795 rq->sense_len = clone->sense_len;
798 free_rq_clone(clone);
805 struct request *clone = rq->special;
810 free_rq_clone(clone);
814 * Requeue the original request of a clone.
816 void dm_requeue_unmapped_request(struct request *clone)
818 int rw = rq_data_dir(clone);
819 struct dm_rq_target_io *tio = clone->end_io_data;
864 static void dm_done(struct request *clone, int error, bool mapped)
867 struct dm_rq_target_io *tio = clone->end_io_data;
871 r = rq_end_io(tio->ti, clone, error, &tio->info);
875 dm_end_request(clone, r);
881 dm_requeue_unmapped_request(clone);
894 struct request *clone = rq->completion_data;
895 struct dm_rq_target_io *tio = clone->end_io_data;
900 dm_done(clone, tio->error, mapped);
904 * Complete the clone and the original request with the error status
907 static void dm_complete_request(struct request *clone, int error)
909 struct dm_rq_target_io *tio = clone->end_io_data;
913 rq->completion_data = clone;
918 * Complete the not-mapped clone and the original request with the error status
923 void dm_kill_unmapped_request(struct request *clone, int error)
925 struct dm_rq_target_io *tio = clone->end_io_data;
929 dm_complete_request(clone, error);
936 static void end_clone_request(struct request *clone, int error)
940 * the clone was dispatched.
941 * The clone is *NOT* freed actually here because it is alloced from
942 * dm own mempool and REQ_ALLOCED isn't set in clone->cmd_flags.
944 __blk_put_request(clone->q, clone);
954 dm_complete_request(clone, error);
987 static void __map_bio(struct dm_target *ti, struct bio *clone,
994 clone->bi_end_io = clone_endio;
995 clone->bi_private = tio;
998 * Map the clone. If r == 0 we don't need to do
1003 sector = clone->bi_sector;
1004 r = ti->type->map(ti, clone, &tio->info);
1008 trace_block_bio_remap(bdev_get_queue(clone->bi_bdev), clone,
1011 generic_make_request(clone);
1019 clone->bi_private = md->bs;
1020 bio_put(clone);
1052 struct bio *clone;
1055 clone = bio_alloc_bioset(GFP_NOIO, 1, bs);
1056 clone->bi_destructor = dm_bio_destructor;
1057 *clone->bi_io_vec = *bv;
1059 clone->bi_sector = sector;
1060 clone->bi_bdev = bio->bi_bdev;
1061 clone->bi_rw = bio->bi_rw;
1062 clone->bi_vcnt = 1;
1063 clone->bi_size = to_bytes(len);
1064 clone->bi_io_vec->bv_offset = offset;
1065 clone->bi_io_vec->bv_len = clone->bi_size;
1066 clone->bi_flags |= 1 << BIO_CLONED;
1069 bio_integrity_clone(clone, bio, GFP_NOIO, bs);
1070 bio_integrity_trim(clone,
1074 return clone;
1084 struct bio *clone;
1086 clone = bio_alloc_bioset(GFP_NOIO, bio->bi_max_vecs, bs);
1087 __bio_clone(clone, bio);
1088 clone->bi_destructor = dm_bio_destructor;
1089 clone->bi_sector = sector;
1090 clone->bi_idx = idx;
1091 clone->bi_vcnt = idx + bv_count;
1092 clone->bi_size = to_bytes(len);
1093 clone->bi_flags &= ~(1 << BIO_SEG_VALID);
1096 bio_integrity_clone(clone, bio, GFP_NOIO, bs);
1098 if (idx != bio->bi_idx || clone->bi_size < bio->bi_size)
1099 bio_integrity_trim(clone,
1103 return clone;
1122 struct bio *clone;
1131 clone = bio_alloc_bioset(GFP_NOIO, ci->bio->bi_max_vecs, ci->md->bs);
1132 __bio_clone(clone, ci->bio);
1133 clone->bi_destructor = dm_bio_destructor;
1135 clone->bi_sector = ci->sector;
1136 clone->bi_size = to_bytes(len);
1139 __map_bio(ti, clone, tio);
1164 * Perform all io with a single clone.
1168 struct bio *clone, *bio = ci->bio;
1172 clone = clone_bio(bio, ci->sector, ci->idx,
1175 __map_bio(ti, clone, tio);
1210 struct bio *clone, *bio = ci->bio;
1227 * the remaining io with a single clone.
1251 clone = clone_bio(bio, ci->sector, ci->idx, i - ci->idx, len,
1253 __map_bio(ti, clone, tio);
1279 clone = split_bvec(bio, ci->sector, ci->idx,
1283 __map_bio(ti, clone, tio);
1488 static int setup_clone(struct request *clone, struct request *rq,
1493 r = blk_rq_prep_clone(clone, rq, tio->md->bs, GFP_ATOMIC,
1498 clone->cmd = rq->cmd;
1499 clone->cmd_len = rq->cmd_len;
1500 clone->sense = rq->sense;
1501 clone->buffer = rq->buffer;
1502 clone->end_io = end_clone_request;
1503 clone->end_io_data = tio;
1511 struct request *clone;
1524 clone = &tio->clone;
1525 if (setup_clone(clone, rq, tio)) {
1531 return clone;
1540 struct request *clone;
1547 clone = clone_rq(rq, md, GFP_ATOMIC);
1548 if (!clone)
1551 rq->special = clone;
1562 static int map_request(struct dm_target *ti, struct request *clone,
1566 struct dm_rq_target_io *tio = clone->end_io_data;
1578 r = ti->type->map_rq(ti, clone, &tio->info);
1585 trace_block_rq_remap(clone->q, clone, disk_devt(dm_disk(md)),
1587 dm_dispatch_request(clone);
1591 dm_requeue_unmapped_request(clone);
1601 dm_kill_unmapped_request(clone, r);
1617 struct request *rq, *clone;
1643 clone = rq->special;
1644 atomic_inc(&md->pending[rq_data_dir(clone)]);
1647 if (map_request(ti, clone, md))