diff options
author | Jens Axboe <axboe@fb.com> | 2015-07-24 12:37:59 -0600 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-07-29 08:55:20 -0600 |
commit | b7c44ed9d2fc6b461378c65eaf144ccc80a47772 (patch) | |
tree | 2f38bdc1cf7ea6c924f6e1d52cf5913c370e08b6 /include/linux | |
parent | 4246a0b63bd8f56a1469b12eafeb875b1041a451 (diff) | |
download | op-kernel-dev-b7c44ed9d2fc6b461378c65eaf144ccc80a47772.zip op-kernel-dev-b7c44ed9d2fc6b461378c65eaf144ccc80a47772.tar.gz |
block: manipulate bio->bi_flags through helpers
Some places use helpers now, others don't. We only have the 'is set'
helper, add helpers for setting and clearing flags too.
It was a bit of a mess of atomic vs non-atomic access. With
BIO_UPTODATE gone, we don't have any risk of concurrent access to the
flags. So relax the restriction and don't make any of them atomic. The
flags that do have serialization issues (reffed and chained), we
already handle those separately.
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/bio.h | 15 | ||||
-rw-r--r-- | include/linux/blk_types.h | 2 |
2 files changed, 15 insertions, 2 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 6b91817..986e6e19 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -304,6 +304,21 @@ static inline void bio_cnt_set(struct bio *bio, unsigned int count) atomic_set(&bio->__bi_cnt, count); } +static inline bool bio_flagged(struct bio *bio, unsigned int bit) +{ + return (bio->bi_flags & (1UL << bit)) != 0; +} + +static inline void bio_set_flag(struct bio *bio, unsigned int bit) +{ + bio->bi_flags |= (1UL << bit); +} + +static inline void bio_clear_flag(struct bio *bio, unsigned int bit) +{ + bio->bi_flags &= ~(1UL << bit); +} + enum bip_flags { BIP_BLOCK_INTEGRITY = 1 << 0, /* block layer owns integrity data */ BIP_MAPPED_INTEGRITY = 1 << 1, /* ref tag has been remapped */ diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 6164fb8..a765a50 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -129,8 +129,6 @@ struct bio { #define BIO_RESET_BITS 13 #define BIO_OWNS_VEC 13 /* bio_free() should free bvec */ -#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) - /* * top 4 bits of bio flags indicate the pool this bio came from */ |