[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-virtualization
Subject: Re: [PATCH v2 2/3] tcm_vhost: Use iov_num_pages to calculate sgl_count
From: "Nicholas A. Bellinger" <nab () linux-iscsi ! org>
Date: 2013-01-29 18:52:26
Message-ID: 1359485546.23290.1386.camel () haakon2 ! linux-iscsi ! org
[Download RAW message or body]
On Tue, 2013-01-22 at 11:20 +0800, Asias He wrote:
> Signed-off-by: Asias He <asias@redhat.com>
> ---
Applied to target-pending/for-next.
Thanks!
--nab
> drivers/vhost/tcm_vhost.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c
> index ca35c16..796a6b0 100644
> --- a/drivers/vhost/tcm_vhost.c
> +++ b/drivers/vhost/tcm_vhost.c
> @@ -479,11 +479,9 @@ static int vhost_scsi_map_iov_to_sgl(struct tcm_vhost_cmd *tv_cmd,
> * Find out how long sglist needs to be
> */
> sgl_count = 0;
> - for (i = 0; i < niov; i++) {
> - sgl_count += (((uintptr_t)iov[i].iov_base + iov[i].iov_len +
> - PAGE_SIZE - 1) >> PAGE_SHIFT) -
> - ((uintptr_t)iov[i].iov_base >> PAGE_SHIFT);
> - }
> + for (i = 0; i < niov; i++)
> + sgl_count += iov_num_pages(&iov[i]);
> +
> /* TODO overflow checking */
>
> sg = kmalloc(sizeof(tv_cmd->tvc_sgl[0]) * sgl_count, GFP_ATOMIC);
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic