From: Jens Axboe Date: Wed, 18 Jul 2007 11:18:08 +0000 (+0200) Subject: bio: make freeing of ->bi_io_vec conditional in bio_free() X-Git-Tag: v2.6.24-rc1~833^2~2^2~7 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=992c5ddaf1b8b85d2252339c4c89adf7469c09ca;p=linux-2.6 bio: make freeing of ->bi_io_vec conditional in bio_free() The empty barrier patches do not carry data, so they have no iovec attached. Signed-off-by: Jens Axboe --- diff --git a/fs/bio.c b/fs/bio.c index ac987fc7ac..d59ddbf796 100644 --- a/fs/bio.c +++ b/fs/bio.c @@ -109,11 +109,14 @@ static inline struct bio_vec *bvec_alloc_bs(gfp_t gfp_mask, int nr, unsigned lon void bio_free(struct bio *bio, struct bio_set *bio_set) { - const int pool_idx = BIO_POOL_IDX(bio); + if (bio->bi_io_vec) { + const int pool_idx = BIO_POOL_IDX(bio); - BIO_BUG_ON(pool_idx >= BIOVEC_NR_POOLS); + BIO_BUG_ON(pool_idx >= BIOVEC_NR_POOLS); + + mempool_free(bio->bi_io_vec, bio_set->bvec_pools[pool_idx]); + } - mempool_free(bio->bi_io_vec, bio_set->bvec_pools[pool_idx]); mempool_free(bio, bio_set->bio_pool); }