mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
block: pass iov_iter to the BLOCK_PC mapping functions
Make use of a new interface provided by iov_iter, backed by scatter-gather list of iovec, instead of the old interface based on sg_iovec. Also use iov_iter_advance() instead of manual iteration. This commit should contain only literal replacements, without functional changes. Cc: Christoph Hellwig <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Doug Gilbert <[email protected]> Cc: "James E.J. Bottomley" <[email protected]> Signed-off-by: Kent Overstreet <[email protected]> [dpark: add more description in commit message] Signed-off-by: Dongsu Park <[email protected]> [hch: fixed to do a deep clone of the iov_iter, and to properly use the iov_iter direction] Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
1dfa0f68c0
commit
26e49cfc7e
6 changed files with 101 additions and 126 deletions
|
|
@ -1734,22 +1734,19 @@ sg_start_req(Sg_request *srp, unsigned char *cmd)
|
|||
}
|
||||
|
||||
if (iov_count) {
|
||||
int len, size = sizeof(struct sg_iovec) * iov_count;
|
||||
int size = sizeof(struct iovec) * iov_count;
|
||||
struct iovec *iov;
|
||||
struct iov_iter i;
|
||||
|
||||
iov = memdup_user(hp->dxferp, size);
|
||||
if (IS_ERR(iov))
|
||||
return PTR_ERR(iov);
|
||||
|
||||
len = iov_length(iov, iov_count);
|
||||
if (hp->dxfer_len < len) {
|
||||
iov_count = iov_shorten(iov, iov_count, hp->dxfer_len);
|
||||
len = hp->dxfer_len;
|
||||
}
|
||||
iov_iter_init(&i, rw, iov, iov_count,
|
||||
min_t(size_t, hp->dxfer_len,
|
||||
iov_length(iov, iov_count)));
|
||||
|
||||
res = blk_rq_map_user_iov(q, rq, md, (struct sg_iovec *)iov,
|
||||
iov_count,
|
||||
len, GFP_ATOMIC);
|
||||
res = blk_rq_map_user_iov(q, rq, md, &i, GFP_ATOMIC);
|
||||
kfree(iov);
|
||||
} else
|
||||
res = blk_rq_map_user(q, rq, md, hp->dxferp,
|
||||
|
|
|
|||
Loading…
Reference in a new issue