summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-10-16 12:29:29 +0200
committerJens Axboe <jens.axboe@oracle.com>2007-10-16 12:29:29 +0200
commita39d113936370ba524fa9e34d6954c3625c8aa64 (patch)
tree6e4334d4fe9018a6032a2cf47f144e1716ca30ad /fs
parent8b6800fbced0c6745a9b8f5f72f15ef8bce8a6be (diff)
parent7e3da6c4b9a69f44b758b2c88190ac33ac4ea1a1 (diff)
downloadlinux-a39d113936370ba524fa9e34d6954c3625c8aa64.tar.gz
linux-a39d113936370ba524fa9e34d6954c3625c8aa64.tar.bz2
linux-a39d113936370ba524fa9e34d6954c3625c8aa64.zip
Merge branch 'barrier' into for-linus
Diffstat (limited to 'fs')
-rw-r--r--fs/bio.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/fs/bio.c b/fs/bio.c
index 5f604f269dfa..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
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);
}
@@ -127,21 +130,9 @@ static void bio_fs_destructor(struct bio *bio)
void bio_init(struct bio *bio)
{
- bio->bi_next = NULL;
- bio->bi_bdev = NULL;
+ memset(bio, 0, sizeof(*bio));
bio->bi_flags = 1 << BIO_UPTODATE;
- bio->bi_rw = 0;
- bio->bi_vcnt = 0;
- bio->bi_idx = 0;
- bio->bi_phys_segments = 0;
- bio->bi_hw_segments = 0;
- bio->bi_hw_front_size = 0;
- bio->bi_hw_back_size = 0;
- bio->bi_size = 0;
- bio->bi_max_vecs = 0;
- bio->bi_end_io = NULL;
atomic_set(&bio->bi_cnt, 1);
- bio->bi_private = NULL;
}
/**