diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-08-04 16:56:34 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-09-11 13:30:56 -0400 |
commit | 9042846bc7ae69cc3288d85af6bad16208d93a95 (patch) | |
tree | d46077d217d31ce5600ef870c92fcdf330922b41 /fs/btrfs/async-thread.h | |
parent | ceab36edd3d3ad3ffd01d41d6d1e05ac1ff8357e (diff) |
Btrfs: Allow worker threads to exit when idle
The Btrfs worker threads don't currently die off after they have
been idle for a while, leading to a lot of threads sitting around
doing nothing for each mount.
Also, they are unable to start atomically (from end_io hanlders).
This commit reworks the worker threads so they can be started
from end_io handlers (just setting a flag that asks for a thread
to be added at a later date) and so they can exit if they
have been idle for a long time.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/async-thread.h')
-rw-r--r-- | fs/btrfs/async-thread.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/btrfs/async-thread.h b/fs/btrfs/async-thread.h index 1b511c109db6..a562ad8d83aa 100644 --- a/fs/btrfs/async-thread.h +++ b/fs/btrfs/async-thread.h | |||
@@ -73,6 +73,15 @@ struct btrfs_workers { | |||
73 | /* force completions in the order they were queued */ | 73 | /* force completions in the order they were queued */ |
74 | int ordered; | 74 | int ordered; |
75 | 75 | ||
76 | /* more workers required, but in an interrupt handler */ | ||
77 | int atomic_start_pending; | ||
78 | |||
79 | /* | ||
80 | * are we allowed to sleep while starting workers or are we required | ||
81 | * to start them at a later time? | ||
82 | */ | ||
83 | int atomic_worker_start; | ||
84 | |||
76 | /* list with all the work threads. The workers on the idle thread | 85 | /* list with all the work threads. The workers on the idle thread |
77 | * may be actively servicing jobs, but they haven't yet hit the | 86 | * may be actively servicing jobs, but they haven't yet hit the |
78 | * idle thresh limit above. | 87 | * idle thresh limit above. |