2 * Copyright (C) 2004 Red Hat UK Ltd.
4 * This file is released under the GPL.
10 #include <linux/bio.h>
19 static inline int bio_list_empty(const struct bio_list
*bl
)
21 return bl
->head
== NULL
;
24 static inline void bio_list_init(struct bio_list
*bl
)
26 bl
->head
= bl
->tail
= NULL
;
29 #define bio_list_for_each(bio, bl) \
30 for (bio = (bl)->head; bio; bio = bio->bi_next)
32 static inline unsigned bio_list_size(const struct bio_list
*bl
)
37 bio_list_for_each(bio
, bl
)
43 static inline void bio_list_add(struct bio_list
*bl
, struct bio
*bio
)
48 bl
->tail
->bi_next
= bio
;
55 static inline void bio_list_merge(struct bio_list
*bl
, struct bio_list
*bl2
)
61 bl
->tail
->bi_next
= bl2
->head
;
68 static inline void bio_list_merge_head(struct bio_list
*bl
,
75 bl2
->tail
->bi_next
= bl
->head
;
82 static inline struct bio
*bio_list_pop(struct bio_list
*bl
)
84 struct bio
*bio
= bl
->head
;
87 bl
->head
= bl
->head
->bi_next
;
97 static inline struct bio
*bio_list_get(struct bio_list
*bl
)
99 struct bio
*bio
= bl
->head
;
101 bl
->head
= bl
->tail
= NULL
;
106 #endif /* CONFIG_BLOCK */