[v2,19/35] bio.h: move bio_has_data() and bio_no_advance_iter() to blk_types.h
Commit Message
"struct bio" has nothing to do with "bio.h", the naming is just
confusing. This move will allow narrowing other dependencies later.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
include/linux/bio.h | 22 ----------------------
include/linux/blk_types.h | 23 +++++++++++++++++++++++
2 files changed, 23 insertions(+), 22 deletions(-)
@@ -49,28 +49,6 @@ static inline unsigned int bio_max_segs(unsigned int nr_segs)
#define bio_data_dir(bio) \
(op_is_write(bio_op(bio)) ? WRITE : READ)
-/*
- * Check whether this bio carries any data or not. A NULL bio is allowed.
- */
-static inline bool bio_has_data(struct bio *bio)
-{
- if (bio &&
- bio->bi_iter.bi_size &&
- bio_op(bio) != REQ_OP_DISCARD &&
- bio_op(bio) != REQ_OP_SECURE_ERASE &&
- bio_op(bio) != REQ_OP_WRITE_ZEROES)
- return true;
-
- return false;
-}
-
-static inline bool bio_no_advance_iter(const struct bio *bio)
-{
- return bio_op(bio) == REQ_OP_DISCARD ||
- bio_op(bio) == REQ_OP_SECURE_ERASE ||
- bio_op(bio) == REQ_OP_WRITE_ZEROES;
-}
-
static inline void *bio_data(struct bio *bio)
{
if (bio_has_data(bio))
@@ -284,6 +284,7 @@ struct bio {
#define BIO_RESET_BYTES offsetof(struct bio, bi_max_vecs)
#define BIO_MAX_SECTORS (UINT_MAX >> SECTOR_SHIFT)
+
/*
* bio flags
*/
@@ -434,6 +435,28 @@ static inline enum req_op bio_op(const struct bio *bio)
return bio->bi_opf & REQ_OP_MASK;
}
+/*
+ * Check whether this bio carries any data or not. A NULL bio is allowed.
+ */
+static inline bool bio_has_data(struct bio *bio)
+{
+ if (bio &&
+ bio->bi_iter.bi_size &&
+ bio_op(bio) != REQ_OP_DISCARD &&
+ bio_op(bio) != REQ_OP_SECURE_ERASE &&
+ bio_op(bio) != REQ_OP_WRITE_ZEROES)
+ return true;
+
+ return false;
+}
+
+static inline bool bio_no_advance_iter(const struct bio *bio)
+{
+ return bio_op(bio) == REQ_OP_DISCARD ||
+ bio_op(bio) == REQ_OP_SECURE_ERASE ||
+ bio_op(bio) == REQ_OP_WRITE_ZEROES;
+}
+
static inline bool blk_op_is_passthrough(blk_opf_t op)
{
op &= REQ_OP_MASK;