diff options
author | Peter Osterlund <petero2@telia.com> | 2005-09-06 18:16:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-07 19:57:20 -0400 |
commit | 3676347a5e216a7fec7f8eedbbcf8bed6b9c4e40 (patch) | |
tree | 3b5880b862390590da8edfb98c3e62aa573d0b28 /fs | |
parent | 6f00df24ee394f345a8789d3a2f98fc1d9195b9f (diff) |
[PATCH] kill bio->bi_set
Jens:
->bi_set is totally unnecessary bloat of struct bio. Just define a proper
destructor for the bio and it already knows what bio_set it belongs too.
Peter:
Fixed the bugs.
Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Peter Osterlund <petero2@telia.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bio.c | 32 |
1 files changed, 21 insertions, 11 deletions
@@ -104,18 +104,22 @@ static inline struct bio_vec *bvec_alloc_bs(unsigned int __nocast gfp_mask, int | |||
104 | return bvl; | 104 | return bvl; |
105 | } | 105 | } |
106 | 106 | ||
107 | /* | 107 | void bio_free(struct bio *bio, struct bio_set *bio_set) |
108 | * default destructor for a bio allocated with bio_alloc_bioset() | ||
109 | */ | ||
110 | static void bio_destructor(struct bio *bio) | ||
111 | { | 108 | { |
112 | const int pool_idx = BIO_POOL_IDX(bio); | 109 | const int pool_idx = BIO_POOL_IDX(bio); |
113 | struct bio_set *bs = bio->bi_set; | ||
114 | 110 | ||
115 | BIO_BUG_ON(pool_idx >= BIOVEC_NR_POOLS); | 111 | BIO_BUG_ON(pool_idx >= BIOVEC_NR_POOLS); |
116 | 112 | ||
117 | mempool_free(bio->bi_io_vec, bs->bvec_pools[pool_idx]); | 113 | mempool_free(bio->bi_io_vec, bio_set->bvec_pools[pool_idx]); |
118 | mempool_free(bio, bs->bio_pool); | 114 | mempool_free(bio, bio_set->bio_pool); |
115 | } | ||
116 | |||
117 | /* | ||
118 | * default destructor for a bio allocated with bio_alloc_bioset() | ||
119 | */ | ||
120 | static void bio_fs_destructor(struct bio *bio) | ||
121 | { | ||
122 | bio_free(bio, fs_bio_set); | ||
119 | } | 123 | } |
120 | 124 | ||
121 | inline void bio_init(struct bio *bio) | 125 | inline void bio_init(struct bio *bio) |
@@ -171,8 +175,6 @@ struct bio *bio_alloc_bioset(unsigned int __nocast gfp_mask, int nr_iovecs, stru | |||
171 | bio->bi_max_vecs = bvec_slabs[idx].nr_vecs; | 175 | bio->bi_max_vecs = bvec_slabs[idx].nr_vecs; |
172 | } | 176 | } |
173 | bio->bi_io_vec = bvl; | 177 | bio->bi_io_vec = bvl; |
174 | bio->bi_destructor = bio_destructor; | ||
175 | bio->bi_set = bs; | ||
176 | } | 178 | } |
177 | out: | 179 | out: |
178 | return bio; | 180 | return bio; |
@@ -180,7 +182,12 @@ out: | |||
180 | 182 | ||
181 | struct bio *bio_alloc(unsigned int __nocast gfp_mask, int nr_iovecs) | 183 | struct bio *bio_alloc(unsigned int __nocast gfp_mask, int nr_iovecs) |
182 | { | 184 | { |
183 | return bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set); | 185 | struct bio *bio = bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set); |
186 | |||
187 | if (bio) | ||
188 | bio->bi_destructor = bio_fs_destructor; | ||
189 | |||
190 | return bio; | ||
184 | } | 191 | } |
185 | 192 | ||
186 | void zero_fill_bio(struct bio *bio) | 193 | void zero_fill_bio(struct bio *bio) |
@@ -273,8 +280,10 @@ struct bio *bio_clone(struct bio *bio, unsigned int __nocast gfp_mask) | |||
273 | { | 280 | { |
274 | struct bio *b = bio_alloc_bioset(gfp_mask, bio->bi_max_vecs, fs_bio_set); | 281 | struct bio *b = bio_alloc_bioset(gfp_mask, bio->bi_max_vecs, fs_bio_set); |
275 | 282 | ||
276 | if (b) | 283 | if (b) { |
284 | b->bi_destructor = bio_fs_destructor; | ||
277 | __bio_clone(b, bio); | 285 | __bio_clone(b, bio); |
286 | } | ||
278 | 287 | ||
279 | return b; | 288 | return b; |
280 | } | 289 | } |
@@ -1075,6 +1084,7 @@ subsys_initcall(init_bio); | |||
1075 | 1084 | ||
1076 | EXPORT_SYMBOL(bio_alloc); | 1085 | EXPORT_SYMBOL(bio_alloc); |
1077 | EXPORT_SYMBOL(bio_put); | 1086 | EXPORT_SYMBOL(bio_put); |
1087 | EXPORT_SYMBOL(bio_free); | ||
1078 | EXPORT_SYMBOL(bio_endio); | 1088 | EXPORT_SYMBOL(bio_endio); |
1079 | EXPORT_SYMBOL(bio_init); | 1089 | EXPORT_SYMBOL(bio_init); |
1080 | EXPORT_SYMBOL(__bio_clone); | 1090 | EXPORT_SYMBOL(__bio_clone); |