Skip to content

Commit

Permalink
bio: make freeing of ->bi_io_vec conditional in bio_free()
Browse files Browse the repository at this point in the history
The empty barrier patches do not carry data, so they have no
iovec attached.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Jens Axboe committed Oct 16, 2007
1 parent 2b94de5 commit 992c5dd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fs/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 992c5dd

Please sign in to comment.