Skip to content

Commit 361301a

Browse files
Guoqing Jiangaxboe
authored andcommitted
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: Guoqing Jiang <guoqing.jiang@cloud.ionos.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent fc4cc77 commit 361301a

1 file changed

Lines changed: 10 additions & 20 deletions

File tree

‎block/blk-core.c‎

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,23 +1581,6 @@ void blk_rq_unprep_clone(struct request *rq)
15811581
}
15821582
EXPORT_SYMBOL_GPL(blk_rq_unprep_clone);
15831583

1584-
/*
1585-
* Copy attributes of the original request to the clone request.
1586-
* The actual data parts (e.g. ->cmd, ->sense) are not copied.
1587-
*/
1588-
static void __blk_rq_prep_clone(struct request *dst, struct request *src)
1589-
{
1590-
dst->__sector = blk_rq_pos(src);
1591-
dst->__data_len = blk_rq_bytes(src);
1592-
if (src->rq_flags & RQF_SPECIAL_PAYLOAD) {
1593-
dst->rq_flags |= RQF_SPECIAL_PAYLOAD;
1594-
dst->special_vec = src->special_vec;
1595-
}
1596-
dst->nr_phys_segments = src->nr_phys_segments;
1597-
dst->ioprio = src->ioprio;
1598-
dst->extra_len = src->extra_len;
1599-
}
1600-
16011584
/**
16021585
* blk_rq_prep_clone - Helper function to setup clone request
16031586
* @rq: the request to be setup
@@ -1610,8 +1593,6 @@ static void __blk_rq_prep_clone(struct request *dst, struct request *src)
16101593
*
16111594
* Description:
16121595
* Clones bios in @rq_src to @rq, and copies attributes of @rq_src to @rq.
1613-
* The actual data parts of @rq_src (e.g. ->cmd, ->sense)
1614-
* are not copied, and copying such parts is the caller's responsibility.
16151596
* Also, pages which the original bios are pointing to are not copied
16161597
* and the cloned bios just point same pages.
16171598
* 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,
16421623
rq->bio = rq->biotail = bio;
16431624
}
16441625

1645-
__blk_rq_prep_clone(rq, rq_src);
1626+
/* Copy attributes of the original request to the clone request. */
1627+
rq->__sector = blk_rq_pos(rq_src);
1628+
rq->__data_len = blk_rq_bytes(rq_src);
1629+
if (rq_src->rq_flags & RQF_SPECIAL_PAYLOAD) {
1630+
rq->rq_flags |= RQF_SPECIAL_PAYLOAD;
1631+
rq->special_vec = rq_src->special_vec;
1632+
}
1633+
rq->nr_phys_segments = rq_src->nr_phys_segments;
1634+
rq->ioprio = rq_src->ioprio;
1635+
rq->extra_len = rq_src->extra_len;
16461636

16471637
return 0;
16481638

0 commit comments

Comments
 (0)