aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/bio.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/bio.h')
-rw-r--r--include/linux/bio.h17
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) 293static 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
300static 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
295enum bip_flags { 309enum 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
415extern void bio_endio(struct bio *, int); 429extern void bio_endio(struct bio *, int);
416extern void bio_endio_nodec(struct bio *, int);
417struct request_queue; 430struct request_queue;
418extern int bio_phys_segments(struct request_queue *, struct bio *); 431extern int bio_phys_segments(struct request_queue *, struct bio *);
419 432