diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-02-04 09:19:41 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-02-04 09:19:41 -0500 |
commit | a68370515356a3eddbfaf7f56418b3cf85d76c2c (patch) | |
tree | 362cfc618cc2eee50f43d91600b9e829539976c5 /fs/btrfs/volumes.c | |
parent | 89f135d8b53bcccafd91a075366d2704ba257cf3 (diff) |
Btrfs: Catch missed bios in the async bio submission thread
The async bio submission thread was missing some bios that were
added after it had decided there was no work left to do.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index fd0bedb07a64..bcd14ebccae1 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -154,6 +154,7 @@ static noinline int run_scheduled_bios(struct btrfs_device *device) | |||
154 | loop: | 154 | loop: |
155 | spin_lock(&device->io_lock); | 155 | spin_lock(&device->io_lock); |
156 | 156 | ||
157 | loop_lock: | ||
157 | /* take all the bios off the list at once and process them | 158 | /* take all the bios off the list at once and process them |
158 | * later on (without the lock held). But, remember the | 159 | * later on (without the lock held). But, remember the |
159 | * tail and other pointers so the bios can be properly reinserted | 160 | * tail and other pointers so the bios can be properly reinserted |
@@ -203,7 +204,7 @@ loop: | |||
203 | * is now congested. Back off and let other work structs | 204 | * is now congested. Back off and let other work structs |
204 | * run instead | 205 | * run instead |
205 | */ | 206 | */ |
206 | if (pending && bdi_write_congested(bdi) && | 207 | if (pending && bdi_write_congested(bdi) && num_run > 16 && |
207 | fs_info->fs_devices->open_devices > 1) { | 208 | fs_info->fs_devices->open_devices > 1) { |
208 | struct bio *old_head; | 209 | struct bio *old_head; |
209 | 210 | ||
@@ -215,7 +216,8 @@ loop: | |||
215 | tail->bi_next = old_head; | 216 | tail->bi_next = old_head; |
216 | else | 217 | else |
217 | device->pending_bio_tail = tail; | 218 | device->pending_bio_tail = tail; |
218 | device->running_pending = 0; | 219 | |
220 | device->running_pending = 1; | ||
219 | 221 | ||
220 | spin_unlock(&device->io_lock); | 222 | spin_unlock(&device->io_lock); |
221 | btrfs_requeue_work(&device->work); | 223 | btrfs_requeue_work(&device->work); |
@@ -224,6 +226,11 @@ loop: | |||
224 | } | 226 | } |
225 | if (again) | 227 | if (again) |
226 | goto loop; | 228 | goto loop; |
229 | |||
230 | spin_lock(&device->io_lock); | ||
231 | if (device->pending_bios) | ||
232 | goto loop_lock; | ||
233 | spin_unlock(&device->io_lock); | ||
227 | done: | 234 | done: |
228 | return 0; | 235 | return 0; |
229 | } | 236 | } |