diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-04-12 11:48:36 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2021-04-12 11:48:45 -0400 |
commit | b422ff58ba8eedcfef3b67b66468660f07b0cfc1 (patch) | |
tree | b9a02fbf56200076c7692b3ab7863bba5c98985d /libbcachefs/alloc_background.c | |
parent | 816ec6051675444d28a2b52ca3aac2558e9178c4 (diff) |
Update bcachefs sources to a8b3ce7599 fixup! bcachefs: Eliminate more PAGE_SIZE uses
Diffstat (limited to 'libbcachefs/alloc_background.c')
-rw-r--r-- | libbcachefs/alloc_background.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libbcachefs/alloc_background.c b/libbcachefs/alloc_background.c index 48971fcf..b2821e63 100644 --- a/libbcachefs/alloc_background.c +++ b/libbcachefs/alloc_background.c @@ -1104,7 +1104,8 @@ static int bch2_allocator_thread(void *arg) pr_debug("free_inc now empty"); - do { + while (1) { + cond_resched(); /* * Find some buckets that we can invalidate, either * they're completely unused, or only contain clean data @@ -1127,22 +1128,21 @@ static int bch2_allocator_thread(void *arg) wake_up_process(c->gc_thread); } + if (nr) + break; + /* * If we found any buckets, we have to invalidate them * before we scan for more - but if we didn't find very * many we may want to wait on more buckets being * available so we don't spin: */ - if (!nr || - (nr < ALLOC_SCAN_BATCH(ca) && - !fifo_empty(&ca->free[RESERVE_NONE]))) { - ret = wait_buckets_available(c, ca); - if (ret) { - up_read(&c->gc_lock); - goto stop; - } + ret = wait_buckets_available(c, ca); + if (ret) { + up_read(&c->gc_lock); + goto stop; } - } while (!nr); + } up_read(&c->gc_lock); |