aboutsummaryrefslogtreecommitdiffstats
path: root/fs/bio.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-07-18 07:18:08 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-10-16 05:03:52 -0400
commit992c5ddaf1b8b85d2252339c4c89adf7469c09ca (patch)
tree67c802af524f923cf20ebcdde2220d72e539121b /fs/bio.c
parent2b94de552e07610dfa79fc49ea49d1cfa5cd9ce8 (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.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/bio.c b/fs/bio.c
index ac987fc7acd9..d59ddbf79626 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
109 109
110void bio_free(struct bio *bio, struct bio_set *bio_set) 110void bio_free(struct bio *bio, struct bio_set *bio_set)
111{ 111{
112 const int pool_idx = BIO_POOL_IDX(bio); 112 if (bio->bi_io_vec) {
113 const int pool_idx = BIO_POOL_IDX(bio);
113 114
114 BIO_BUG_ON(pool_idx >= BIOVEC_NR_POOLS); 115 BIO_BUG_ON(pool_idx >= BIOVEC_NR_POOLS);
116
117 mempool_free(bio->bi_io_vec, bio_set->bvec_pools[pool_idx]);
118 }
115 119
116 mempool_free(bio->bi_io_vec, bio_set->bvec_pools[pool_idx]);
117 mempool_free(bio, bio_set->bio_pool); 120 mempool_free(bio, bio_set->bio_pool);
118} 121}
119 122