btrfs compression: reuse recently used workspace
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Tue, 24 Jun 2014 15:00:44 +0000 (00:00 +0900)
committerChris Mason <clm@fb.com>
Sat, 28 Jun 2014 20:48:46 +0000 (13:48 -0700)
Add compression `workspace' in free_workspace() to
`idle_workspace' list head, instead of tail. So we have
better chances to reuse most recently used `workspace'.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/compression.c

index 92371c41422861a4a38c287e67a63be0f00b3089..1daea0b47187b58db65dde86411e88578473fcf4 100644 (file)
@@ -821,7 +821,7 @@ static void free_workspace(int type, struct list_head *workspace)
 
        spin_lock(workspace_lock);
        if (*num_workspace < num_online_cpus()) {
-               list_add_tail(workspace, idle_workspace);
+               list_add(workspace, idle_workspace);
                (*num_workspace)++;
                spin_unlock(workspace_lock);
                goto wake;