diff options
author | Keith Busch <kbusch@kernel.org> | 2024-09-13 20:28:50 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-09-13 20:31:45 +0200 |
commit | d2c5b1faccd5ef6352456f817e941945d3b3fe62 (patch) | |
tree | 1fb77d875dedb6498afbdfb25e00917aa92f758e /block/blk-integrity.c | |
parent | blk-integrity: consider entire bio list for merging (diff) | |
download | linux-d2c5b1faccd5ef6352456f817e941945d3b3fe62.tar.xz linux-d2c5b1faccd5ef6352456f817e941945d3b3fe62.zip |
block: provide a request helper for user integrity segments
Provide a helper to keep the request flags and nr_integrity_segments in
sync with the bio's integrity payload. This is an integrity equivalent
to the normal data helper function, 'blk_rq_map_user()'.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Link: https://lore.kernel.org/r/20240913182854.2445457-6-kbusch@meta.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-integrity.c')
-rw-r--r-- | block/blk-integrity.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 84065691aaed..ddc742d58330 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -107,6 +107,20 @@ new_segment: } EXPORT_SYMBOL(blk_rq_map_integrity_sg); +int blk_rq_integrity_map_user(struct request *rq, void __user *ubuf, + ssize_t bytes, u32 seed) +{ + int ret = bio_integrity_map_user(rq->bio, ubuf, bytes, seed); + + if (ret) + return ret; + + rq->nr_integrity_segments = blk_rq_count_integrity_sg(rq->q, rq->bio); + rq->cmd_flags |= REQ_INTEGRITY; + return 0; +} +EXPORT_SYMBOL_GPL(blk_rq_integrity_map_user); + bool blk_integrity_merge_rq(struct request_queue *q, struct request *req, struct request *next) { |