diff options
Diffstat (limited to 'fs/afs/kafstimod.c')
-rw-r--r-- | fs/afs/kafstimod.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/fs/afs/kafstimod.c b/fs/afs/kafstimod.c index 694344e4d3c7..3526dcccc163 100644 --- a/fs/afs/kafstimod.c +++ b/fs/afs/kafstimod.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* kafstimod.c: AFS timeout daemon | 1 | /* AFS timeout daemon |
2 | * | 2 | * |
3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. |
4 | * Written by David Howells (dhowells@redhat.com) | 4 | * Written by David Howells (dhowells@redhat.com) |
@@ -30,7 +30,6 @@ static DEFINE_SPINLOCK(kafstimod_lock); | |||
30 | 30 | ||
31 | static int kafstimod(void *arg); | 31 | static int kafstimod(void *arg); |
32 | 32 | ||
33 | /*****************************************************************************/ | ||
34 | /* | 33 | /* |
35 | * start the timeout daemon | 34 | * start the timeout daemon |
36 | */ | 35 | */ |
@@ -45,9 +44,8 @@ int afs_kafstimod_start(void) | |||
45 | wait_for_completion(&kafstimod_alive); | 44 | wait_for_completion(&kafstimod_alive); |
46 | 45 | ||
47 | return ret; | 46 | return ret; |
48 | } /* end afs_kafstimod_start() */ | 47 | } |
49 | 48 | ||
50 | /*****************************************************************************/ | ||
51 | /* | 49 | /* |
52 | * stop the timeout daemon | 50 | * stop the timeout daemon |
53 | */ | 51 | */ |
@@ -57,10 +55,8 @@ void afs_kafstimod_stop(void) | |||
57 | kafstimod_die = 1; | 55 | kafstimod_die = 1; |
58 | wake_up(&kafstimod_sleepq); | 56 | wake_up(&kafstimod_sleepq); |
59 | wait_for_completion(&kafstimod_dead); | 57 | wait_for_completion(&kafstimod_dead); |
58 | } | ||
60 | 59 | ||
61 | } /* end afs_kafstimod_stop() */ | ||
62 | |||
63 | /*****************************************************************************/ | ||
64 | /* | 60 | /* |
65 | * timeout processing daemon | 61 | * timeout processing daemon |
66 | */ | 62 | */ |
@@ -77,7 +73,7 @@ static int kafstimod(void *arg) | |||
77 | complete(&kafstimod_alive); | 73 | complete(&kafstimod_alive); |
78 | 74 | ||
79 | /* loop around looking for things to attend to */ | 75 | /* loop around looking for things to attend to */ |
80 | loop: | 76 | loop: |
81 | set_current_state(TASK_INTERRUPTIBLE); | 77 | set_current_state(TASK_INTERRUPTIBLE); |
82 | add_wait_queue(&kafstimod_sleepq, &myself); | 78 | add_wait_queue(&kafstimod_sleepq, &myself); |
83 | 79 | ||
@@ -101,8 +97,7 @@ static int kafstimod(void *arg) | |||
101 | spin_lock(&kafstimod_lock); | 97 | spin_lock(&kafstimod_lock); |
102 | if (list_empty(&kafstimod_list)) { | 98 | if (list_empty(&kafstimod_list)) { |
103 | timeout = MAX_SCHEDULE_TIMEOUT; | 99 | timeout = MAX_SCHEDULE_TIMEOUT; |
104 | } | 100 | } else { |
105 | else { | ||
106 | timer = list_entry(kafstimod_list.next, | 101 | timer = list_entry(kafstimod_list.next, |
107 | struct afs_timer, link); | 102 | struct afs_timer, link); |
108 | timeout = timer->timo_jif; | 103 | timeout = timer->timo_jif; |
@@ -110,10 +105,7 @@ static int kafstimod(void *arg) | |||
110 | 105 | ||
111 | if (time_before_eq((unsigned long) timeout, jif)) | 106 | if (time_before_eq((unsigned long) timeout, jif)) |
112 | goto immediate; | 107 | goto immediate; |
113 | 108 | timeout = (long) timeout - (long) jiffies; | |
114 | else { | ||
115 | timeout = (long) timeout - (long) jiffies; | ||
116 | } | ||
117 | } | 109 | } |
118 | spin_unlock(&kafstimod_lock); | 110 | spin_unlock(&kafstimod_lock); |
119 | 111 | ||
@@ -126,7 +118,7 @@ static int kafstimod(void *arg) | |||
126 | * - we come here with the lock held and timer pointing to the expired | 118 | * - we come here with the lock held and timer pointing to the expired |
127 | * entry | 119 | * entry |
128 | */ | 120 | */ |
129 | immediate: | 121 | immediate: |
130 | remove_wait_queue(&kafstimod_sleepq, &myself); | 122 | remove_wait_queue(&kafstimod_sleepq, &myself); |
131 | set_current_state(TASK_RUNNING); | 123 | set_current_state(TASK_RUNNING); |
132 | 124 | ||
@@ -141,10 +133,8 @@ static int kafstimod(void *arg) | |||
141 | 133 | ||
142 | _debug("@@@ End Timeout"); | 134 | _debug("@@@ End Timeout"); |
143 | goto loop; | 135 | goto loop; |
136 | } | ||
144 | 137 | ||
145 | } /* end kafstimod() */ | ||
146 | |||
147 | /*****************************************************************************/ | ||
148 | /* | 138 | /* |
149 | * (re-)queue a timer | 139 | * (re-)queue a timer |
150 | */ | 140 | */ |
@@ -176,9 +166,8 @@ void afs_kafstimod_add_timer(struct afs_timer *timer, unsigned long timeout) | |||
176 | wake_up(&kafstimod_sleepq); | 166 | wake_up(&kafstimod_sleepq); |
177 | 167 | ||
178 | _leave(""); | 168 | _leave(""); |
179 | } /* end afs_kafstimod_add_timer() */ | 169 | } |
180 | 170 | ||
181 | /*****************************************************************************/ | ||
182 | /* | 171 | /* |
183 | * dequeue a timer | 172 | * dequeue a timer |
184 | * - returns 0 if the timer was deleted or -ENOENT if it wasn't queued | 173 | * - returns 0 if the timer was deleted or -ENOENT if it wasn't queued |
@@ -202,4 +191,4 @@ int afs_kafstimod_del_timer(struct afs_timer *timer) | |||
202 | 191 | ||
203 | _leave(" = %d", ret); | 192 | _leave(" = %d", ret); |
204 | return ret; | 193 | return ret; |
205 | } /* end afs_kafstimod_del_timer() */ | 194 | } |