2 * Copyright (C) 2004 Red Hat UK Ltd.
4 * This file is released under the GPL.
10 #include <linux/bio.h>
17 static inline int bio_list_empty(const struct bio_list
*bl
)
19 return bl
->head
== NULL
;
22 #define BIO_LIST_INIT { .head = NULL, .tail = NULL }
24 #define BIO_LIST(bl) \
25 struct bio_list bl = BIO_LIST_INIT
27 static inline void bio_list_init(struct bio_list
*bl
)
29 bl
->head
= bl
->tail
= NULL
;
32 #define bio_list_for_each(bio, bl) \
33 for (bio = (bl)->head; bio; bio = bio->bi_next)
35 static inline unsigned bio_list_size(const struct bio_list
*bl
)
40 bio_list_for_each(bio
, bl
)
46 static inline void bio_list_add(struct bio_list
*bl
, struct bio
*bio
)
51 bl
->tail
->bi_next
= bio
;
58 static inline void bio_list_merge(struct bio_list
*bl
, struct bio_list
*bl2
)
64 bl
->tail
->bi_next
= bl2
->head
;
71 static inline void bio_list_merge_head(struct bio_list
*bl
,
78 bl2
->tail
->bi_next
= bl
->head
;
85 static inline struct bio
*bio_list_pop(struct bio_list
*bl
)
87 struct bio
*bio
= bl
->head
;
90 bl
->head
= bl
->head
->bi_next
;
100 static inline struct bio
*bio_list_get(struct bio_list
*bl
)
102 struct bio
*bio
= bl
->head
;
104 bl
->head
= bl
->tail
= NULL
;