Commit 361301a2 authored by Guoqing Jiang's avatar Guoqing Jiang Committed by Jens Axboe

block: cleanup for _blk/blk_rq_prep_clone

Both cmd and sense had been moved to scsi_request, so remove
the related comments to avoid confusion.

And as Bart suggested, move _blk_rq_prep_clone into the only
caller (blk_rq_prep_clone).
Signed-off-by: default avatarGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent fc4cc772
...@@ -1581,23 +1581,6 @@ void blk_rq_unprep_clone(struct request *rq) ...@@ -1581,23 +1581,6 @@ void blk_rq_unprep_clone(struct request *rq)
} }
EXPORT_SYMBOL_GPL(blk_rq_unprep_clone); EXPORT_SYMBOL_GPL(blk_rq_unprep_clone);
/*
* Copy attributes of the original request to the clone request.
* The actual data parts (e.g. ->cmd, ->sense) are not copied.
*/
static void __blk_rq_prep_clone(struct request *dst, struct request *src)
{
dst->__sector = blk_rq_pos(src);
dst->__data_len = blk_rq_bytes(src);
if (src->rq_flags & RQF_SPECIAL_PAYLOAD) {
dst->rq_flags |= RQF_SPECIAL_PAYLOAD;
dst->special_vec = src->special_vec;
}
dst->nr_phys_segments = src->nr_phys_segments;
dst->ioprio = src->ioprio;
dst->extra_len = src->extra_len;
}
/** /**
* blk_rq_prep_clone - Helper function to setup clone request * blk_rq_prep_clone - Helper function to setup clone request
* @rq: the request to be setup * @rq: the request to be setup
...@@ -1610,8 +1593,6 @@ static void __blk_rq_prep_clone(struct request *dst, struct request *src) ...@@ -1610,8 +1593,6 @@ static void __blk_rq_prep_clone(struct request *dst, struct request *src)
* *
* Description: * Description:
* Clones bios in @rq_src to @rq, and copies attributes of @rq_src to @rq. * Clones bios in @rq_src to @rq, and copies attributes of @rq_src to @rq.
* The actual data parts of @rq_src (e.g. ->cmd, ->sense)
* are not copied, and copying such parts is the caller's responsibility.
* Also, pages which the original bios are pointing to are not copied * Also, pages which the original bios are pointing to are not copied
* and the cloned bios just point same pages. * and the cloned bios just point same pages.
* So cloned bios must be completed before original bios, which means * So cloned bios must be completed before original bios, which means
...@@ -1642,7 +1623,16 @@ int blk_rq_prep_clone(struct request *rq, struct request *rq_src, ...@@ -1642,7 +1623,16 @@ int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
rq->bio = rq->biotail = bio; rq->bio = rq->biotail = bio;
} }
__blk_rq_prep_clone(rq, rq_src); /* Copy attributes of the original request to the clone request. */
rq->__sector = blk_rq_pos(rq_src);
rq->__data_len = blk_rq_bytes(rq_src);
if (rq_src->rq_flags & RQF_SPECIAL_PAYLOAD) {
rq->rq_flags |= RQF_SPECIAL_PAYLOAD;
rq->special_vec = rq_src->special_vec;
}
rq->nr_phys_segments = rq_src->nr_phys_segments;
rq->ioprio = rq_src->ioprio;
rq->extra_len = rq_src->extra_len;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment