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_add_head(struct bio_list *bl, struct bio *bio)
57 bio->bi_next = bl->head;
65 static inline void bio_list_merge(struct bio_list *bl, struct bio_list *bl2)
71 bl->tail->bi_next = bl2->head;
78 static inline void bio_list_merge_head(struct bio_list *bl,
85 bl2->tail->bi_next = bl->head;
92 static inline struct bio *bio_list_pop(struct bio_list *bl)
94 struct bio *bio = bl->head;
97 bl->head = bl->head->bi_next;
107 static inline struct bio *bio_list_get(struct bio_list *bl)
109 struct bio *bio = bl->head;
111 bl->head = bl->tail = NULL;
116 #endif /* CONFIG_BLOCK */