aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/async-thread.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2009-02-04 09:19:41 -0500
committerChris Mason <chris.mason@oracle.com>2009-02-04 09:19:41 -0500
commita68370515356a3eddbfaf7f56418b3cf85d76c2c (patch)
tree362cfc618cc2eee50f43d91600b9e829539976c5 /fs/btrfs/async-thread.c
parent89f135d8b53bcccafd91a075366d2704ba257cf3 (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/async-thread.c')
-rw-r--r--fs/btrfs/async-thread.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
index d5f4e94f2ca2..f2e80f3768ec 100644
--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -349,6 +349,7 @@ int btrfs_requeue_work(struct btrfs_work *work)
349{ 349{
350 struct btrfs_worker_thread *worker = work->worker; 350 struct btrfs_worker_thread *worker = work->worker;
351 unsigned long flags; 351 unsigned long flags;
352 int wake = 0;
352 353
353 if (test_and_set_bit(WORK_QUEUED_BIT, &work->flags)) 354 if (test_and_set_bit(WORK_QUEUED_BIT, &work->flags))
354 goto out; 355 goto out;
@@ -367,10 +368,16 @@ int btrfs_requeue_work(struct btrfs_work *work)
367 &worker->workers->worker_list); 368 &worker->workers->worker_list);
368 spin_unlock_irqrestore(&worker->workers->lock, flags); 369 spin_unlock_irqrestore(&worker->workers->lock, flags);
369 } 370 }
371 if (!worker->working) {
372 wake = 1;
373 worker->working = 1;
374 }
370 375
371 spin_unlock_irqrestore(&worker->lock, flags); 376 spin_unlock_irqrestore(&worker->lock, flags);
372 377 if (wake)
378 wake_up_process(worker->task);
373out: 379out:
380
374 return 0; 381 return 0;
375} 382}
376 383
@@ -397,6 +404,7 @@ int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work)
397 } 404 }
398 405
399 spin_lock_irqsave(&worker->lock, flags); 406 spin_lock_irqsave(&worker->lock, flags);
407
400 atomic_inc(&worker->num_pending); 408 atomic_inc(&worker->num_pending);
401 check_busy_worker(worker); 409 check_busy_worker(worker);
402 list_add_tail(&work->list, &worker->pending); 410 list_add_tail(&work->list, &worker->pending);