aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-10-16 06:29:29 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-10-16 06:29:29 -0400
commita39d113936370ba524fa9e34d6954c3625c8aa64 (patch)
tree6e4334d4fe9018a6032a2cf47f144e1716ca30ad /fs
parent8b6800fbced0c6745a9b8f5f72f15ef8bce8a6be (diff)
parent7e3da6c4b9a69f44b758b2c88190ac33ac4ea1a1 (diff)
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
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
@@ -127,21 +130,9 @@ static void bio_fs_destructor(struct bio *bio)
127 130
128void bio_init(struct bio *bio) 131void bio_init(struct bio *bio)
129{ 132{
130 bio->bi_next = NULL; 133 memset(bio, 0, sizeof(*bio));
131 bio->bi_bdev = NULL;
132 bio->bi_flags = 1 << BIO_UPTODATE; 134 bio->bi_flags = 1 << BIO_UPTODATE;
133 bio->bi_rw = 0;
134 bio->bi_vcnt = 0;
135 bio->bi_idx = 0;
136 bio->bi_phys_segments = 0;
137 bio->bi_hw_segments = 0;
138 bio->bi_hw_front_size = 0;
139 bio->bi_hw_back_size = 0;
140 bio->bi_size = 0;
141 bio->bi_max_vecs = 0;
142 bio->bi_end_io = NULL;
143 atomic_set(&bio->bi_cnt, 1); 135 atomic_set(&bio->bi_cnt, 1);
144 bio->bi_private = NULL;
145} 136}
146 137
147/** 138/**