diff options
author | Christoph Hellwig <hch@lst.de> | 2009-04-07 13:55:13 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-04-15 02:28:09 -0400 |
commit | 8f3d8ba20e67991b531e9c0227dcd1f99271a32c (patch) | |
tree | 337efd46f067ce3b7eeab0c3627b02a7edef4afd /drivers/md | |
parent | 0882e8dd3aad33eca41696d463bb896e6c8817eb (diff) |
block: move bio list helpers into bio.h
It's used by DM and MD and generally useful, so move the bio list
helpers into bio.h.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-bio-list.h | 117 | ||||
-rw-r--r-- | drivers/md/dm-delay.c | 2 | ||||
-rw-r--r-- | drivers/md/dm-mpath.c | 1 | ||||
-rw-r--r-- | drivers/md/dm-raid1.c | 1 | ||||
-rw-r--r-- | drivers/md/dm-region-hash.c | 1 | ||||
-rw-r--r-- | drivers/md/dm-snap.c | 1 | ||||
-rw-r--r-- | drivers/md/dm.c | 1 | ||||
-rw-r--r-- | drivers/md/raid1.c | 1 | ||||
-rw-r--r-- | drivers/md/raid10.c | 1 |
9 files changed, 0 insertions, 126 deletions
diff --git a/drivers/md/dm-bio-list.h b/drivers/md/dm-bio-list.h deleted file mode 100644 index 345098b4ca77..000000000000 --- a/drivers/md/dm-bio-list.h +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
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 | #ifdef CONFIG_BLOCK | ||
13 | |||
14 | struct bio_list { | ||
15 | struct bio *head; | ||
16 | struct bio *tail; | ||
17 | }; | ||
18 | |||
19 | static inline int bio_list_empty(const struct bio_list *bl) | ||
20 | { | ||
21 | return bl->head == NULL; | ||
22 | } | ||
23 | |||
24 | static inline void bio_list_init(struct bio_list *bl) | ||
25 | { | ||
26 | bl->head = bl->tail = NULL; | ||
27 | } | ||
28 | |||
29 | #define bio_list_for_each(bio, bl) \ | ||
30 | for (bio = (bl)->head; bio; bio = bio->bi_next) | ||
31 | |||
32 | static inline unsigned bio_list_size(const struct bio_list *bl) | ||
33 | { | ||
34 | unsigned sz = 0; | ||
35 | struct bio *bio; | ||
36 | |||
37 | bio_list_for_each(bio, bl) | ||
38 | sz++; | ||
39 | |||
40 | return sz; | ||
41 | } | ||
42 | |||
43 | static inline void bio_list_add(struct bio_list *bl, struct bio *bio) | ||
44 | { | ||
45 | bio->bi_next = NULL; | ||
46 | |||
47 | if (bl->tail) | ||
48 | bl->tail->bi_next = bio; | ||
49 | else | ||
50 | bl->head = bio; | ||
51 | |||
52 | bl->tail = bio; | ||
53 | } | ||
54 | |||
55 | static inline void bio_list_add_head(struct bio_list *bl, struct bio *bio) | ||
56 | { | ||
57 | bio->bi_next = bl->head; | ||
58 | |||
59 | bl->head = bio; | ||
60 | |||
61 | if (!bl->tail) | ||
62 | bl->tail = bio; | ||
63 | } | ||
64 | |||
65 | static inline void bio_list_merge(struct bio_list *bl, struct bio_list *bl2) | ||
66 | { | ||
67 | if (!bl2->head) | ||
68 | return; | ||
69 | |||
70 | if (bl->tail) | ||
71 | bl->tail->bi_next = bl2->head; | ||
72 | else | ||
73 | bl->head = bl2->head; | ||
74 | |||
75 | bl->tail = bl2->tail; | ||
76 | } | ||
77 | |||
78 | static inline void bio_list_merge_head(struct bio_list *bl, | ||
79 | struct bio_list *bl2) | ||
80 | { | ||
81 | if (!bl2->head) | ||
82 | return; | ||
83 | |||
84 | if (bl->head) | ||
85 | bl2->tail->bi_next = bl->head; | ||
86 | else | ||
87 | bl->tail = bl2->tail; | ||
88 | |||
89 | bl->head = bl2->head; | ||
90 | } | ||
91 | |||
92 | static inline struct bio *bio_list_pop(struct bio_list *bl) | ||
93 | { | ||
94 | struct bio *bio = bl->head; | ||
95 | |||
96 | if (bio) { | ||
97 | bl->head = bl->head->bi_next; | ||
98 | if (!bl->head) | ||
99 | bl->tail = NULL; | ||
100 | |||
101 | bio->bi_next = NULL; | ||
102 | } | ||
103 | |||
104 | return bio; | ||
105 | } | ||
106 | |||
107 | static inline struct bio *bio_list_get(struct bio_list *bl) | ||
108 | { | ||
109 | struct bio *bio = bl->head; | ||
110 | |||
111 | bl->head = bl->tail = NULL; | ||
112 | |||
113 | return bio; | ||
114 | } | ||
115 | |||
116 | #endif /* CONFIG_BLOCK */ | ||
117 | #endif | ||
diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c index 59ee1b015d2d..559dbb52bc85 100644 --- a/drivers/md/dm-delay.c +++ b/drivers/md/dm-delay.c | |||
@@ -15,8 +15,6 @@ | |||
15 | 15 | ||
16 | #include <linux/device-mapper.h> | 16 | #include <linux/device-mapper.h> |
17 | 17 | ||
18 | #include "dm-bio-list.h" | ||
19 | |||
20 | #define DM_MSG_PREFIX "delay" | 18 | #define DM_MSG_PREFIX "delay" |
21 | 19 | ||
22 | struct delay_c { | 20 | struct delay_c { |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 095f77bf9681..6a386ab4f7eb 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <linux/device-mapper.h> | 8 | #include <linux/device-mapper.h> |
9 | 9 | ||
10 | #include "dm-path-selector.h" | 10 | #include "dm-path-selector.h" |
11 | #include "dm-bio-list.h" | ||
12 | #include "dm-bio-record.h" | 11 | #include "dm-bio-record.h" |
13 | #include "dm-uevent.h" | 12 | #include "dm-uevent.h" |
14 | 13 | ||
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index 536ef0bef154..076fbb4e967a 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * This file is released under the GPL. | 5 | * This file is released under the GPL. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include "dm-bio-list.h" | ||
9 | #include "dm-bio-record.h" | 8 | #include "dm-bio-record.h" |
10 | 9 | ||
11 | #include <linux/init.h> | 10 | #include <linux/init.h> |
diff --git a/drivers/md/dm-region-hash.c b/drivers/md/dm-region-hash.c index 59f8d9df9e1a..7b899be0b087 100644 --- a/drivers/md/dm-region-hash.c +++ b/drivers/md/dm-region-hash.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/vmalloc.h> | 14 | #include <linux/vmalloc.h> |
15 | 15 | ||
16 | #include "dm.h" | 16 | #include "dm.h" |
17 | #include "dm-bio-list.h" | ||
18 | 17 | ||
19 | #define DM_MSG_PREFIX "region hash" | 18 | #define DM_MSG_PREFIX "region hash" |
20 | 19 | ||
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 981a0413068f..d73f17fc7778 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/workqueue.h> | 22 | #include <linux/workqueue.h> |
23 | 23 | ||
24 | #include "dm-exception-store.h" | 24 | #include "dm-exception-store.h" |
25 | #include "dm-bio-list.h" | ||
26 | 25 | ||
27 | #define DM_MSG_PREFIX "snapshots" | 26 | #define DM_MSG_PREFIX "snapshots" |
28 | 27 | ||
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 8a994be035ba..424f7b048c30 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -6,7 +6,6 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include "dm.h" | 8 | #include "dm.h" |
9 | #include "dm-bio-list.h" | ||
10 | #include "dm-uevent.h" | 9 | #include "dm-uevent.h" |
11 | 10 | ||
12 | #include <linux/init.h> | 11 | #include <linux/init.h> |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 274b491a11c1..36df9109cde1 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <linux/blkdev.h> | 35 | #include <linux/blkdev.h> |
36 | #include <linux/seq_file.h> | 36 | #include <linux/seq_file.h> |
37 | #include "md.h" | 37 | #include "md.h" |
38 | #include "dm-bio-list.h" | ||
39 | #include "raid1.h" | 38 | #include "raid1.h" |
40 | #include "bitmap.h" | 39 | #include "bitmap.h" |
41 | 40 | ||
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index e293d92641ac..81a54f17417e 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/blkdev.h> | 22 | #include <linux/blkdev.h> |
23 | #include <linux/seq_file.h> | 23 | #include <linux/seq_file.h> |
24 | #include "md.h" | 24 | #include "md.h" |
25 | #include "dm-bio-list.h" | ||
26 | #include "raid10.h" | 25 | #include "raid10.h" |
27 | #include "bitmap.h" | 26 | #include "bitmap.h" |
28 | 27 | ||