]> asedeno.scripts.mit.edu Git - linux.git/commit
btrfs: make find_workspace always succeed
authorDavid Sterba <dsterba@suse.com>
Wed, 27 Apr 2016 00:41:17 +0000 (02:41 +0200)
committerDavid Sterba <dsterba@suse.com>
Wed, 27 Apr 2016 00:59:38 +0000 (02:59 +0200)
commit3b501d18aa4f75fe23af5b0bf592d62fd82cca5b
tree77eb94832c0a3fe106e3f7e99a8328f90cd5416b
parent3853368b95f27d9bdaf9e15bc1e11753f11e3c43
btrfs: make find_workspace always succeed

With just one preallocated workspace we can guarantee forward progress
even if there's no memory available for new workspaces. The cost is more
waiting but we also get rid of several error paths.

On average, there will be several idle workspaces, so the waiting
penalty won't be so bad.

In the worst case, all cpus will compete for one workspace until there's
some memory. Attempts to allocate a new one are done each time the
waiters are woken up.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/compression.c