]> err.no Git - linux-2.6/commitdiff
[PATCH] fix creating zero sized bio mempools in low memory system
authorMilan Broz <mbroz@redhat.com>
Mon, 4 Sep 2006 13:37:57 +0000 (15:37 +0200)
committerJens Axboe <axboe@nelson.home.kernel.dk>
Sat, 30 Sep 2006 18:52:33 +0000 (20:52 +0200)
In the very low memory systems is in the init_bio call
scale parameter set to zero and it leads to creating
zero sized mempool.

This patch prevents pool_entries parameter become zero,
so the created pool have at least 1 entry.

Mempool with 0 entries lead to incorrect behaviour
of mempool_free. (Alloc requests are not waken up
and system stalls in mempool_alloc->ioschedule).

Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/bio.c

index 6a0b9ad8f8c9d031d4c32fb32e1c53e0677d1ef2..52de79c299424d9806dafe475b362246c14a5087 100644 (file)
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -1142,7 +1142,7 @@ static int biovec_create_pools(struct bio_set *bs, int pool_entries, int scale)
                struct biovec_slab *bp = bvec_slabs + i;
                mempool_t **bvp = bs->bvec_pools + i;
 
-               if (i >= scale)
+               if (pool_entries > 1 && i >= scale)
                        pool_entries >>= 1;
 
                *bvp = mempool_create_slab_pool(pool_entries, bp->slab);