diff options
Diffstat (limited to 'include/linux/bio.h')
-rw-r--r-- | include/linux/bio.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index da3a127c9958..f0291cf64cc5 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -290,7 +290,21 @@ static inline unsigned bio_segments(struct bio *bio) | |||
290 | * returns. and then bio would be freed memory when if (bio->bi_flags ...) | 290 | * returns. and then bio would be freed memory when if (bio->bi_flags ...) |
291 | * runs | 291 | * runs |
292 | */ | 292 | */ |
293 | #define bio_get(bio) atomic_inc(&(bio)->bi_cnt) | 293 | static inline void bio_get(struct bio *bio) |
294 | { | ||
295 | bio->bi_flags |= (1 << BIO_REFFED); | ||
296 | smp_mb__before_atomic(); | ||
297 | atomic_inc(&bio->__bi_cnt); | ||
298 | } | ||
299 | |||
300 | static inline void bio_cnt_set(struct bio *bio, unsigned int count) | ||
301 | { | ||
302 | if (count != 1) { | ||
303 | bio->bi_flags |= (1 << BIO_REFFED); | ||
304 | smp_mb__before_atomic(); | ||
305 | } | ||
306 | atomic_set(&bio->__bi_cnt, count); | ||
307 | } | ||
294 | 308 | ||
295 | enum bip_flags { | 309 | enum bip_flags { |
296 | BIP_BLOCK_INTEGRITY = 1 << 0, /* block layer owns integrity data */ | 310 | BIP_BLOCK_INTEGRITY = 1 << 0, /* block layer owns integrity data */ |
@@ -413,7 +427,6 @@ static inline struct bio *bio_clone_kmalloc(struct bio *bio, gfp_t gfp_mask) | |||
413 | } | 427 | } |
414 | 428 | ||
415 | extern void bio_endio(struct bio *, int); | 429 | extern void bio_endio(struct bio *, int); |
416 | extern void bio_endio_nodec(struct bio *, int); | ||
417 | struct request_queue; | 430 | struct request_queue; |
418 | extern int bio_phys_segments(struct request_queue *, struct bio *); | 431 | extern int bio_phys_segments(struct request_queue *, struct bio *); |
419 | 432 | ||