From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Kleikamp Subject: [PATCH V6 14/30] bio: add bvec_length(), like iov_length() Date: Tue, 29 Jan 2013 10:23:27 -0600 Message-ID: <1359476623-10544-15-git-send-email-dave.kleikamp@oracle.com> References: <1359476623-10544-1-git-send-email-dave.kleikamp@oracle.com> Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Zach Brown , "Maxim V. Patlasov" , Dave Kleikamp To: Alexander Viro Return-path: Received: from aserp1040.oracle.com ([141.146.126.69]:35180 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751591Ab3A2QYY (ORCPT ); Tue, 29 Jan 2013 11:24:24 -0500 In-Reply-To: <1359476623-10544-1-git-send-email-dave.kleikamp@oracle.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Zach Brown Signed-off-by: Dave Kleikamp Cc: Zach Brown --- include/linux/bio.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/bio.h b/include/linux/bio.h index 820e7aa..f5f9829 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -290,6 +290,14 @@ extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set extern void bvec_free_bs(struct bio_set *, struct bio_vec *, unsigned int); extern unsigned int bvec_nr_vecs(unsigned short idx); +static inline ssize_t bvec_length(const struct bio_vec *bvec, unsigned long nr) +{ + ssize_t bytes = 0; + while (nr--) + bytes += (bvec++)->bv_len; + return bytes; +} + #ifdef CONFIG_BLK_CGROUP int bio_associate_current(struct bio *bio); void bio_disassociate_task(struct bio *bio); -- 1.8.1.1