diff options
author | Jens Axboe | 2007-07-18 13:18:08 +0200 |
---|---|---|
committer | Jens Axboe | 2007-10-16 11:03:52 +0200 |
commit | 992c5ddaf1b8b85d2252339c4c89adf7469c09ca (patch) | |
tree | 67c802af524f923cf20ebcdde2220d72e539121b /fs/bio.c | |
parent | 2b94de552e07610dfa79fc49ea49d1cfa5cd9ce8 (diff) |
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 <jens.axboe@oracle.com>
Diffstat (limited to 'fs/bio.c')
-rw-r--r-- | fs/bio.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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); } |