diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/md/dm-bio-list.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'drivers/md/dm-bio-list.h')
-rw-r--r-- | drivers/md/dm-bio-list.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/drivers/md/dm-bio-list.h b/drivers/md/dm-bio-list.h new file mode 100644 index 000000000000..bc021e1fd4d1 --- /dev/null +++ b/drivers/md/dm-bio-list.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Red Hat UK Ltd. | ||
3 | * | ||
4 | * This file is released under the GPL. | ||
5 | */ | ||
6 | |||
7 | #ifndef DM_BIO_LIST_H | ||
8 | #define DM_BIO_LIST_H | ||
9 | |||
10 | #include <linux/bio.h> | ||
11 | |||
12 | struct bio_list { | ||
13 | struct bio *head; | ||
14 | struct bio *tail; | ||
15 | }; | ||
16 | |||
17 | static inline void bio_list_init(struct bio_list *bl) | ||
18 | { | ||
19 | bl->head = bl->tail = NULL; | ||
20 | } | ||
21 | |||
22 | static inline void bio_list_add(struct bio_list *bl, struct bio *bio) | ||
23 | { | ||
24 | bio->bi_next = NULL; | ||
25 | |||
26 | if (bl->tail) | ||
27 | bl->tail->bi_next = bio; | ||
28 | else | ||
29 | bl->head = bio; | ||
30 | |||
31 | bl->tail = bio; | ||
32 | } | ||
33 | |||
34 | static inline void bio_list_merge(struct bio_list *bl, struct bio_list *bl2) | ||
35 | { | ||
36 | if (bl->tail) | ||
37 | bl->tail->bi_next = bl2->head; | ||
38 | else | ||
39 | bl->head = bl2->head; | ||
40 | |||
41 | bl->tail = bl2->tail; | ||
42 | } | ||
43 | |||
44 | static inline struct bio *bio_list_pop(struct bio_list *bl) | ||
45 | { | ||
46 | struct bio *bio = bl->head; | ||
47 | |||
48 | if (bio) { | ||
49 | bl->head = bl->head->bi_next; | ||
50 | if (!bl->head) | ||
51 | bl->tail = NULL; | ||
52 | |||
53 | bio->bi_next = NULL; | ||
54 | } | ||
55 | |||
56 | return bio; | ||
57 | } | ||
58 | |||
59 | static inline struct bio *bio_list_get(struct bio_list *bl) | ||
60 | { | ||
61 | struct bio *bio = bl->head; | ||
62 | |||
63 | bl->head = bl->tail = NULL; | ||
64 | |||
65 | return bio; | ||
66 | } | ||
67 | |||
68 | #endif | ||