lkml.org 
[lkml]   [2013]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH V9 16/33] bio: add bvec_length(), like iov_length()
    Date
    From: Zach Brown <zab@zabbo.net>

    Signed-off-by: Zach Brown <zab@zabbo.net>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
    ---
    include/linux/bio.h | 8 ++++++++
    1 file changed, 8 insertions(+)

    diff --git a/include/linux/bio.h b/include/linux/bio.h
    index ec48bac..4fd5253 100644
    --- a/include/linux/bio.h
    +++ b/include/linux/bio.h
    @@ -307,6 +307,14 @@ extern struct bio_vec *bvec_alloc(gfp_t, int, unsigned long *, mempool_t *);
    extern void bvec_free(mempool_t *, 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.4


    \
     
     \ /
      Last update: 2013-10-16 16:41    [W:4.298 / U:0.732 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site