From: Asias He Date: Tue, 22 Jan 2013 03:20:25 +0000 (+0800) Subject: tcm_vhost: Introduce iov_num_pages X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=765b34fdc1507add8fd6f1007410e7a375d0f89c;p=linux-beck.git tcm_vhost: Introduce iov_num_pages Add a helper to calculate the number of pages needed for a iov entry. (nab: Drop unnecessary inline) Signed-off-by: Asias He Signed-off-by: Nicholas Bellinger --- diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index 77d760bb2e44..defc28595656 100644 --- a/drivers/vhost/tcm_vhost.c +++ b/drivers/vhost/tcm_vhost.c @@ -77,6 +77,12 @@ static struct workqueue_struct *tcm_vhost_workqueue; static DEFINE_MUTEX(tcm_vhost_mutex); static LIST_HEAD(tcm_vhost_list); +static int iov_num_pages(struct iovec *iov) +{ + return (PAGE_ALIGN((unsigned long)iov->iov_base + iov->iov_len) - + ((unsigned long)iov->iov_base & PAGE_MASK)) >> PAGE_SHIFT; +} + static int tcm_vhost_check_true(struct se_portal_group *se_tpg) { return 1;