From d1315322e4ac2dc65b29657eb6f5d04b6a1bbf96 Mon Sep 17 00:00:00 2001 From: Jason Luo Date: Thu, 25 Feb 2016 16:52:10 +0800 Subject: [PATCH] bio: Fix kabi error The two commits: bio: skip atomic inc/dec of ->bi_remaining for non-chains bio: skip atomic inc/dec of ->bi_cnt for most use cases rename some members of struct bio which causes KABI changes Orabug: 22820562 Signed-off-by: Jason Luo --- block/bio.c | 18 +++++++++--------- fs/btrfs/volumes.c | 2 +- include/linux/bio.h | 4 ++-- include/linux/blk_types.h | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/block/bio.c b/block/bio.c index 259197d97de1..585053238fcb 100644 --- a/block/bio.c +++ b/block/bio.c @@ -270,8 +270,8 @@ void bio_init(struct bio *bio) { memset(bio, 0, sizeof(*bio)); bio->bi_flags = 1 << BIO_UPTODATE; - atomic_set(&bio->__bi_remaining, 1); - atomic_set(&bio->__bi_cnt, 1); + atomic_set(&bio->bi_remaining, 1); + atomic_set(&bio->bi_cnt, 1); } EXPORT_SYMBOL(bio_init); @@ -293,7 +293,7 @@ void bio_reset(struct bio *bio) memset(bio, 0, BIO_RESET_BYTES); bio->bi_flags = flags | (1 << BIO_UPTODATE); - atomic_set(&bio->__bi_remaining, 1); + atomic_set(&bio->bi_remaining, 1); } EXPORT_SYMBOL(bio_reset); @@ -311,7 +311,7 @@ static inline void bio_inc_remaining(struct bio *bio) { bio->bi_flags |= (1 << BIO_CHAIN); smp_mb__before_atomic(); - atomic_inc(&bio->__bi_remaining); + atomic_inc(&bio->bi_remaining); } /** @@ -538,12 +538,12 @@ void bio_put(struct bio *bio) if (!bio_flagged(bio, BIO_REFFED)) bio_free(bio); else { - BIO_BUG_ON(!atomic_read(&bio->__bi_cnt)); + BIO_BUG_ON(!atomic_read(&bio->bi_cnt)); /* * last put frees it */ - if (atomic_dec_and_test(&bio->__bi_cnt)) + if (atomic_dec_and_test(&bio->bi_cnt)) bio_free(bio); } } @@ -1759,15 +1759,15 @@ EXPORT_SYMBOL(bio_flush_dcache_pages); static inline bool bio_remaining_done(struct bio *bio) { /* - * If we're not chaining, then ->__bi_remaining is always 1 and + * If we're not chaining, then ->bi_remaining is always 1 and * we always end io on the first invocation. */ if (!bio_flagged(bio, BIO_CHAIN)) return true; - BUG_ON(atomic_read(&bio->__bi_remaining) <= 0); + BUG_ON(atomic_read(&bio->bi_remaining) <= 0); - if (atomic_dec_and_test(&bio->__bi_remaining)) { + if (atomic_dec_and_test(&bio->bi_remaining)) { clear_bit(BIO_CHAIN, &bio->bi_flags); return true; } diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 53af23f2c087..554ece031e0d 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -345,7 +345,7 @@ loop_lock: waitqueue_active(&fs_info->async_submit_wait)) wake_up(&fs_info->async_submit_wait); - BUG_ON(atomic_read(&cur->__bi_cnt) == 0); + BUG_ON(atomic_read(&cur->bi_cnt) == 0); /* * if we're doing the sync list, record that our diff --git a/include/linux/bio.h b/include/linux/bio.h index f0291cf64cc5..0e7d930620a6 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -294,7 +294,7 @@ static inline void bio_get(struct bio *bio) { bio->bi_flags |= (1 << BIO_REFFED); smp_mb__before_atomic(); - atomic_inc(&bio->__bi_cnt); + atomic_inc(&bio->bi_cnt); } static inline void bio_cnt_set(struct bio *bio, unsigned int count) @@ -303,7 +303,7 @@ static inline void bio_cnt_set(struct bio *bio, unsigned int count) bio->bi_flags |= (1 << BIO_REFFED); smp_mb__before_atomic(); } - atomic_set(&bio->__bi_cnt, count); + atomic_set(&bio->bi_cnt, count); } enum bip_flags { diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index cc2e85a6f5fe..82206993c175 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -65,7 +65,7 @@ struct bio { unsigned int bi_seg_front_size; unsigned int bi_seg_back_size; - atomic_t __bi_remaining; + atomic_t bi_remaining; bio_end_io_t *bi_end_io; @@ -92,7 +92,7 @@ struct bio { unsigned short bi_max_vecs; /* max bvl_vecs we can hold */ - atomic_t __bi_cnt; /* pin count */ + atomic_t bi_cnt; /* pin count */ struct bio_vec *bi_io_vec; /* the actual vec list */ -- 2.50.1