Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1371458 > unrolled thread

[PATCH 20/27] dm: dm-bufio.c: use bio_set_vec_table()

Started byMing Lei <tom.leiming@gmail.com>
First post2016-04-05 14:10 +0200
Last post2016-04-05 20:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 20/27] dm: dm-bufio.c: use bio_set_vec_table() Ming Lei <tom.leiming@gmail.com> - 2016-04-05 14:10 +0200
    Re: [PATCH 20/27] dm: dm-bufio.c: use bio_set_vec_table() Christoph Hellwig <hch@infradead.org> - 2016-04-05 15:10 +0200
      Re: [PATCH 20/27] dm: dm-bufio.c: use bio_set_vec_table() Mike Snitzer <snitzer@redhat.com> - 2016-04-05 20:20 +0200

#1371458 — [PATCH 20/27] dm: dm-bufio.c: use bio_set_vec_table()

FromMing Lei <tom.leiming@gmail.com>
Date2016-04-05 14:10 +0200
Subject[PATCH 20/27] dm: dm-bufio.c: use bio_set_vec_table()
Message-ID<rkxXY-36a-25@gated-at.bofh.it>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 drivers/md/dm-bufio.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index cd77216..0e48ad7 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -624,8 +624,7 @@ static void use_inline_bio(struct dm_buffer *b, int rw, sector_t block,
 	int len;
 
 	bio_init(&b->bio);
-	b->bio.bi_io_vec = b->bio_vec;
-	b->bio.bi_max_vecs = DM_BUFIO_INLINE_VECS;
+	bio_set_vec_table(&b->bio, b->bio_vec, DM_BUFIO_INLINE_VECS);
 	b->bio.bi_iter.bi_sector = block << b->c->sectors_per_block_bits;
 	b->bio.bi_bdev = b->c->bdev;
 	b->bio.bi_end_io = inline_endio;
-- 
1.9.1

[toc] | [next] | [standalone]


#1371553

FromChristoph Hellwig <hch@infradead.org>
Date2016-04-05 15:10 +0200
Message-ID<rkyU2-3Ze-9@gated-at.bofh.it>
In reply to#1371458
On Tue, Apr 05, 2016 at 08:07:35PM +0800, Ming Lei wrote:
> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
> ---
>  drivers/md/dm-bufio.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
> index cd77216..0e48ad7 100644
> --- a/drivers/md/dm-bufio.c
> +++ b/drivers/md/dm-bufio.c
> @@ -624,8 +624,7 @@ static void use_inline_bio(struct dm_buffer *b, int rw, sector_t block,
>  	int len;
>  
>  	bio_init(&b->bio);
> -	b->bio.bi_io_vec = b->bio_vec;
> -	b->bio.bi_max_vecs = DM_BUFIO_INLINE_VECS;
> +	bio_set_vec_table(&b->bio, b->bio_vec, DM_BUFIO_INLINE_VECS);
>  	b->bio.bi_iter.bi_sector = block << b->c->sectors_per_block_bits;
>  	b->bio.bi_bdev = b->c->bdev;
>  	b->bio.bi_end_io = inline_endio;

Should be switched to use bio_alloc instead.

[toc] | [prev] | [next] | [standalone]


#1371857

FromMike Snitzer <snitzer@redhat.com>
Date2016-04-05 20:20 +0200
Message-ID<rkDK2-89t-3@gated-at.bofh.it>
In reply to#1371553
On Tue, Apr 05 2016 at  9:04am -0400,
Christoph Hellwig <hch@infradead.org> wrote:

> On Tue, Apr 05, 2016 at 08:07:35PM +0800, Ming Lei wrote:
> > Signed-off-by: Ming Lei <tom.leiming@gmail.com>
> > ---
> >  drivers/md/dm-bufio.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
> > index cd77216..0e48ad7 100644
> > --- a/drivers/md/dm-bufio.c
> > +++ b/drivers/md/dm-bufio.c
> > @@ -624,8 +624,7 @@ static void use_inline_bio(struct dm_buffer *b, int rw, sector_t block,
> >  	int len;
> >  
> >  	bio_init(&b->bio);
> > -	b->bio.bi_io_vec = b->bio_vec;
> > -	b->bio.bi_max_vecs = DM_BUFIO_INLINE_VECS;
> > +	bio_set_vec_table(&b->bio, b->bio_vec, DM_BUFIO_INLINE_VECS);
> >  	b->bio.bi_iter.bi_sector = block << b->c->sectors_per_block_bits;
> >  	b->bio.bi_bdev = b->c->bdev;
> >  	b->bio.bi_end_io = inline_endio;
> 
> Should be switched to use bio_alloc instead.

Why does the use of bio_init() vs bio_alloc() bother you?

'struct dm_buffer' has a 'struct bio'.  That bio is allocated as part of
the dm_buffer in drivers/md/dmbufio.c:alloc_buffer() -- which is called
by various other bufio interfaces (e.g. __alloc_buffer_wait).  Bufio is
in control of ensuring forward progress by carefully managing the memory
associated with these buffers.  I don't see the benefit of bio_alloc()
here.  What am I missing?

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web