Commit 7b63c052 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: remove __blk_rq_unmap_user

Open code __blk_rq_unmap_user in the two callers.  Both never pass a NULL
bio, and one of them can use an existing local variable instead of the bio
flag.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent f3256075
...@@ -558,20 +558,6 @@ int blk_rq_append_bio(struct request *rq, struct bio **bio) ...@@ -558,20 +558,6 @@ int blk_rq_append_bio(struct request *rq, struct bio **bio)
} }
EXPORT_SYMBOL(blk_rq_append_bio); EXPORT_SYMBOL(blk_rq_append_bio);
static int __blk_rq_unmap_user(struct bio *bio)
{
int ret = 0;
if (bio) {
if (bio_flagged(bio, BIO_USER_MAPPED))
bio_unmap_user(bio);
else
ret = bio_uncopy_user(bio);
}
return ret;
}
static int __blk_rq_map_user_iov(struct request *rq, static int __blk_rq_map_user_iov(struct request *rq,
struct rq_map_data *map_data, struct iov_iter *iter, struct rq_map_data *map_data, struct iov_iter *iter,
gfp_t gfp_mask, bool copy) gfp_t gfp_mask, bool copy)
...@@ -599,7 +585,10 @@ static int __blk_rq_map_user_iov(struct request *rq, ...@@ -599,7 +585,10 @@ static int __blk_rq_map_user_iov(struct request *rq,
*/ */
ret = blk_rq_append_bio(rq, &bio); ret = blk_rq_append_bio(rq, &bio);
if (ret) { if (ret) {
__blk_rq_unmap_user(orig_bio); if (copy)
bio_uncopy_user(orig_bio);
else
bio_unmap_user(orig_bio);
return ret; return ret;
} }
bio_get(bio); bio_get(bio);
...@@ -701,9 +690,13 @@ int blk_rq_unmap_user(struct bio *bio) ...@@ -701,9 +690,13 @@ int blk_rq_unmap_user(struct bio *bio)
if (unlikely(bio_flagged(bio, BIO_BOUNCED))) if (unlikely(bio_flagged(bio, BIO_BOUNCED)))
mapped_bio = bio->bi_private; mapped_bio = bio->bi_private;
ret2 = __blk_rq_unmap_user(mapped_bio); if (bio_flagged(mapped_bio, BIO_USER_MAPPED)) {
if (ret2 && !ret) bio_unmap_user(mapped_bio);
ret = ret2; } else {
ret2 = bio_uncopy_user(mapped_bio);
if (ret2 && !ret)
ret = ret2;
}
mapped_bio = bio; mapped_bio = bio;
bio = bio->bi_next; bio = bio->bi_next;
......
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