linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bio: make use of bvec_nr_vecs
@ 2008-07-25 18:11 Denis ChengRq
  2008-07-26  4:22 ` rae l
  2008-08-04  9:57 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Denis ChengRq @ 2008-07-25 18:11 UTC (permalink / raw)
  To: Jens Axboe, Martin K. Petersen; +Cc: linux-kernel

Since introduced in 7ba1ba12eee, it should be made use of.

Signed-off-by: Denis ChengRq <crquan@gmail.com>
---
Additionally, I think it maybe better if inlined in <linux/bio.h>

 fs/bio.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/bio.c b/fs/bio.c
index 88322b0..7ed91d3 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -77,11 +77,8 @@ struct bio_vec *bvec_alloc_bs(gfp_t gfp_mask, int nr, unsigned long *idx, struct
 	 */
 
 	bvl = mempool_alloc(bs->bvec_pools[*idx], gfp_mask);
-	if (bvl) {
-		struct biovec_slab *bp = bvec_slabs + *idx;
-
-		memset(bvl, 0, bp->nr_vecs * sizeof(struct bio_vec));
-	}
+	if (bvl)
+		memset(bvl, 0, bvec_nr_vecs(*idx) * sizeof(struct bio_vec));
 
 	return bvl;
 }
@@ -149,7 +146,7 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
 				goto out;
 			}
 			bio->bi_flags |= idx << BIO_POOL_OFFSET;
-			bio->bi_max_vecs = bvec_slabs[idx].nr_vecs;
+			bio->bi_max_vecs = bvec_nr_vecs(idx);
 		}
 		bio->bi_io_vec = bvl;
 	}
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] bio: make use of bvec_nr_vecs
  2008-07-25 18:11 [PATCH] bio: make use of bvec_nr_vecs Denis ChengRq
@ 2008-07-26  4:22 ` rae l
  2008-08-04  9:57 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: rae l @ 2008-07-26  4:22 UTC (permalink / raw)
  To: Jens Axboe, Martin K. Petersen; +Cc: linux-kernel

On Sat, Jul 26, 2008 at 2:11 AM, Denis ChengRq <crquan@gmail.com> wrote:
>        bvl = mempool_alloc(bs->bvec_pools[*idx], gfp_mask);
> -       if (bvl) {
> -               struct biovec_slab *bp = bvec_slabs + *idx;
> -
> -               memset(bvl, 0, bp->nr_vecs * sizeof(struct bio_vec));
> -       }
> +       if (bvl)
> +               memset(bvl, 0, bvec_nr_vecs(*idx) * sizeof(struct bio_vec));
and if we have a mempool_zalloc, this can be more simplified,

there was no mempool_zalloc yet, should we create it inlined with
__GFP_ZERO, for this and further use?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] bio: make use of bvec_nr_vecs
  2008-07-25 18:11 [PATCH] bio: make use of bvec_nr_vecs Denis ChengRq
  2008-07-26  4:22 ` rae l
@ 2008-08-04  9:57 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2008-08-04  9:57 UTC (permalink / raw)
  To: Denis ChengRq; +Cc: Martin K. Petersen, linux-kernel

On Sat, Jul 26 2008, Denis ChengRq wrote:
> Since introduced in 7ba1ba12eee, it should be made use of.
> 
> Signed-off-by: Denis ChengRq <crquan@gmail.com>

Thanks, applied.

> Additionally, I think it maybe better if inlined in <linux/bio.h>

Submit a patch :-)

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-08-04  9:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-25 18:11 [PATCH] bio: make use of bvec_nr_vecs Denis ChengRq
2008-07-26  4:22 ` rae l
2008-08-04  9:57 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).