* [PATCH -mm] fs/bio.c: tweaks
@ 2006-08-31 21:20 Andreas Mohr
2006-09-01 5:46 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Mohr @ 2006-08-31 21:20 UTC (permalink / raw)
To: Andrew Morton; +Cc: viro, linux-kernel
Calculate a variable in bvec_alloc_bs() only once needed, not earlier
(bio.o down from 18408 to 18376 Bytes, 32 Bytes saved, probably due to
data locality improvements).
Init variable idx to silence a gcc warning which already existed in the
unmodified original base file (bvec_alloc_bs() handles idx
correctly, so there's no need for the warning):
fs/bio.c: In function `bio_alloc_bioset':
fs/bio.c:169: warning: `idx' may be used uninitialized in this function
Inline bio_set_map_data() since it's only called once.
Compile-tested and run-tested on 2.6.18-rc4-mm3.
Signed-off-by: Andreas Mohr <andi@lisas.de>
--- linux-2.6.18-rc4-mm3.orig/fs/bio.c 2006-09-04 23:38:46.000000000 +0200
+++ linux-2.6.18-rc4-mm3/fs/bio.c 2006-09-08 22:07:54.000000000 +0200
@@ -79,7 +79,6 @@
static inline struct bio_vec *bvec_alloc_bs(gfp_t gfp_mask, int nr, unsigned long *idx, struct bio_set *bs)
{
struct bio_vec *bvl;
- struct biovec_slab *bp;
/*
* see comment near bvec_array define!
@@ -98,10 +97,12 @@
* idx now points to the pool we want to allocate from
*/
- bp = bvec_slabs + *idx;
bvl = mempool_alloc(bs->bvec_pools[*idx], gfp_mask);
- if (bvl)
+ if (bvl) {
+ struct biovec_slab *bp = bvec_slabs + *idx;
+
memset(bvl, 0, bp->nr_vecs * sizeof(struct bio_vec));
+ }
return bvl;
}
@@ -166,7 +167,7 @@
bio_init(bio);
if (likely(nr_iovecs)) {
- unsigned long idx;
+ unsigned long idx = 0; /* shut up gcc */
bvl = bvec_alloc_bs(gfp_mask, nr_iovecs, &idx, bs);
if (unlikely(!bvl)) {
@@ -455,7 +456,7 @@
void __user *userptr;
};
-static void bio_set_map_data(struct bio_map_data *bmd, struct bio *bio)
+static inline void bio_set_map_data(struct bio_map_data *bmd, struct bio *bio)
{
memcpy(bmd->iovecs, bio->bi_io_vec, sizeof(struct bio_vec) * bio->bi_vcnt);
bio->bi_private = bmd;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH -mm] fs/bio.c: tweaks
2006-08-31 21:20 [PATCH -mm] fs/bio.c: tweaks Andreas Mohr
@ 2006-09-01 5:46 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2006-09-01 5:46 UTC (permalink / raw)
To: Andreas Mohr; +Cc: viro, linux-kernel
On Thu, 31 Aug 2006 23:20:23 +0200
Andreas Mohr <andi@rhlx01.fht-esslingen.de> wrote:
> Calculate a variable in bvec_alloc_bs() only once needed, not earlier
> (bio.o down from 18408 to 18376 Bytes, 32 Bytes saved, probably due to
> data locality improvements).
OK, I spose.
> Init variable idx to silence a gcc warning which already existed in the
> unmodified original base file (bvec_alloc_bs() handles idx
> correctly, so there's no need for the warning):
> fs/bio.c: In function `bio_alloc_bioset':
> fs/bio.c:169: warning: `idx' may be used uninitialized in this function
I'm heartily sick of that one too.
> Inline bio_set_map_data() since it's only called once.
Is OK, gcc will take care of that.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-09-01 5:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-31 21:20 [PATCH -mm] fs/bio.c: tweaks Andreas Mohr
2006-09-01 5:46 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome