Skip to content

Commit

Permalink
btrfs: make find_workspace warn if there are no workspaces
Browse files Browse the repository at this point in the history
Be verbose if there are no workspaces at all, ie. the module init time
preallocation failed.

Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
David Sterba committed May 10, 2016
1 parent e721e49 commit 5235671
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions fs/btrfs/compression.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,21 @@ static struct list_head *find_workspace(int type)
* workspace preallocated for each type and the compression
* time is bounded so we get to a workspace eventually. This
* makes our caller's life easier.
*
* To prevent silent and low-probability deadlocks (when the
* initial preallocation fails), check if there are any
* workspaces at all.
*/
if (atomic_read(total_ws) == 0) {
static DEFINE_RATELIMIT_STATE(_rs,
/* once per minute */ 60 * HZ,
/* no burst */ 1);

if (__ratelimit(&_rs)) {
printk(KERN_WARNING
"no compression workspaces, low memory, retrying");
}
}
goto again;
}
return workspace;
Expand Down

0 comments on commit 5235671

Please sign in to comment.