diff options
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 18db4cbe2794..0de51e37e789 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -180,7 +180,11 @@ loop: | |||
180 | pending = pending->bi_next; | 180 | pending = pending->bi_next; |
181 | cur->bi_next = NULL; | 181 | cur->bi_next = NULL; |
182 | atomic_dec(&device->dev_root->fs_info->nr_async_submits); | 182 | atomic_dec(&device->dev_root->fs_info->nr_async_submits); |
183 | |||
184 | BUG_ON(atomic_read(&cur->bi_cnt) == 0); | ||
185 | bio_get(cur); | ||
183 | submit_bio(cur->bi_rw, cur); | 186 | submit_bio(cur->bi_rw, cur); |
187 | bio_put(cur); | ||
184 | num_run++; | 188 | num_run++; |
185 | 189 | ||
186 | /* | 190 | /* |
@@ -188,10 +192,11 @@ loop: | |||
188 | * is now congested. Back off and let other work structs | 192 | * is now congested. Back off and let other work structs |
189 | * run instead | 193 | * run instead |
190 | */ | 194 | */ |
191 | if (pending && num_run && bdi_write_congested(bdi)) { | 195 | if (pending && bdi_write_congested(bdi)) { |
192 | struct bio *old_head; | 196 | struct bio *old_head; |
193 | 197 | ||
194 | spin_lock(&device->io_lock); | 198 | spin_lock(&device->io_lock); |
199 | |||
195 | old_head = device->pending_bios; | 200 | old_head = device->pending_bios; |
196 | device->pending_bios = pending; | 201 | device->pending_bios = pending; |
197 | if (device->pending_bio_tail) | 202 | if (device->pending_bio_tail) |
@@ -2125,7 +2130,9 @@ int schedule_bio(struct btrfs_root *root, struct btrfs_device *device, | |||
2125 | 2130 | ||
2126 | /* don't bother with additional async steps for reads, right now */ | 2131 | /* don't bother with additional async steps for reads, right now */ |
2127 | if (!(rw & (1 << BIO_RW))) { | 2132 | if (!(rw & (1 << BIO_RW))) { |
2133 | bio_get(bio); | ||
2128 | submit_bio(rw, bio); | 2134 | submit_bio(rw, bio); |
2135 | bio_put(bio); | ||
2129 | return 0; | 2136 | return 0; |
2130 | } | 2137 | } |
2131 | 2138 | ||
@@ -2136,6 +2143,7 @@ int schedule_bio(struct btrfs_root *root, struct btrfs_device *device, | |||
2136 | * on a queue for later | 2143 | * on a queue for later |
2137 | */ | 2144 | */ |
2138 | atomic_inc(&root->fs_info->nr_async_submits); | 2145 | atomic_inc(&root->fs_info->nr_async_submits); |
2146 | WARN_ON(bio->bi_next); | ||
2139 | bio->bi_next = NULL; | 2147 | bio->bi_next = NULL; |
2140 | bio->bi_rw |= rw; | 2148 | bio->bi_rw |= rw; |
2141 | 2149 | ||