mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
block: move around bio flagging helpers
We'll need bio_flagged() earlier in bio.h for later patches, move it together with all related helpers, and mark the bio_flagged()'s bio argument as const. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
a0750fae73
commit
d9f514d3e6
@@ -46,6 +46,21 @@ static inline unsigned int bio_max_segs(unsigned int nr_segs)
|
||||
#define bio_data_dir(bio) \
|
||||
(op_is_write(bio_op(bio)) ? WRITE : READ)
|
||||
|
||||
static inline bool bio_flagged(const struct bio *bio, unsigned int bit)
|
||||
{
|
||||
return bio->bi_flags & (1U << bit);
|
||||
}
|
||||
|
||||
static inline void bio_set_flag(struct bio *bio, unsigned int bit)
|
||||
{
|
||||
bio->bi_flags |= (1U << bit);
|
||||
}
|
||||
|
||||
static inline void bio_clear_flag(struct bio *bio, unsigned int bit)
|
||||
{
|
||||
bio->bi_flags &= ~(1U << bit);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether this bio carries any data or not. A NULL bio is allowed.
|
||||
*/
|
||||
@@ -225,21 +240,6 @@ 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 & (1U << bit);
|
||||
}
|
||||
|
||||
static inline void bio_set_flag(struct bio *bio, unsigned int bit)
|
||||
{
|
||||
bio->bi_flags |= (1U << bit);
|
||||
}
|
||||
|
||||
static inline void bio_clear_flag(struct bio *bio, unsigned int bit)
|
||||
{
|
||||
bio->bi_flags &= ~(1U << bit);
|
||||
}
|
||||
|
||||
static inline struct bio_vec *bio_first_bvec_all(struct bio *bio)
|
||||
{
|
||||
WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED));
|
||||
|
||||
Reference in New Issue
Block a user