aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/async-thread.c
diff options
context:
space:
mode:
authorStanislaw Gruszka <stf_xl@wp.pl>2014-02-08 17:18:43 -0500
committerJosef Bacik <jbacik@fb.com>2014-03-10 15:16:36 -0400
commit51b98effa4c673feaa7237ba87645ea60d8f3578 (patch)
tree9549c3c23d36c058dceeddb9b66d830cbacc86dc /fs/btrfs/async-thread.c
parentdcfd5ad2fc3337a959873e9d20ca33ad9809aa90 (diff)
btrfs: always choose work from prio_head first
In case we do not refill, we can overwrite cur pointer from prio_head by one from not prioritized head, what looks as something that was not intended. This change make we always take works from prio_head first until it's not empty. Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl> Signed-off-by: Josef Bacik <jbacik@fb.com>
Diffstat (limited to 'fs/btrfs/async-thread.c')
-rw-r--r--fs/btrfs/async-thread.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
index c1e0b0caf9cc..0b78bf28ff5d 100644
--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -262,18 +262,19 @@ static struct btrfs_work *get_next_work(struct btrfs_worker_thread *worker,
262 struct btrfs_work *work = NULL; 262 struct btrfs_work *work = NULL;
263 struct list_head *cur = NULL; 263 struct list_head *cur = NULL;
264 264
265 if (!list_empty(prio_head)) 265 if (!list_empty(prio_head)) {
266 cur = prio_head->next; 266 cur = prio_head->next;
267 goto out;
268 }
267 269
268 smp_mb(); 270 smp_mb();
269 if (!list_empty(&worker->prio_pending)) 271 if (!list_empty(&worker->prio_pending))
270 goto refill; 272 goto refill;
271 273
272 if (!list_empty(head)) 274 if (!list_empty(head)) {
273 cur = head->next; 275 cur = head->next;
274
275 if (cur)
276 goto out; 276 goto out;
277 }
277 278
278refill: 279refill:
279 spin_lock_irq(&worker->lock); 280 spin_lock_irq(&worker->lock);