From patchwork Tue Jun 24 15:00:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 4409631 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 51B81BEEAA for ; Tue, 24 Jun 2014 15:01:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B964C2017A for ; Tue, 24 Jun 2014 15:01:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 02700201D3 for ; Tue, 24 Jun 2014 15:01:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754253AbaFXPBc (ORCPT ); Tue, 24 Jun 2014 11:01:32 -0400 Received: from mail-pb0-f48.google.com ([209.85.160.48]:35986 "EHLO mail-pb0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754158AbaFXPBb (ORCPT ); Tue, 24 Jun 2014 11:01:31 -0400 Received: by mail-pb0-f48.google.com with SMTP id rq2so354650pbb.21 for ; Tue, 24 Jun 2014 08:01:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=i+oDNiYSblnY7usdiHGCITdBFnW+2uHaCB63rIWVqNA=; b=N+UdXoZ7oqdjHNFLGBm2Ef/M/+HHznpWwcdqQWYlDFnaZyIxV1P3J+IKbXt7c70glB kzpjoMkqv8oCv4GQ/Ia1Nn/oQ8H53miRGfFGxUQQjvTsHAfZ21zrUHFMQMdlx63HdmnM B78+urUjFtPs1xkEww25VCgLEM4QRKpvnQgdnnpslUSv6x7nR5Q2gPppx1qJqSUejFRI TIurl1i7BPbmOaTe7mh/O4OCPGlfrGyr27j3mjAxxggx50yr6ADSyzWn4vDBpk0GMY72 REmWohNYHdwMvS2Pxzg4f9kjDg8P51qwxg82qOtyiIZKNbTm0Nq8OKNIRJP0sLLQ5rkk l48g== X-Received: by 10.68.196.202 with SMTP id io10mr2039075pbc.149.1403622090469; Tue, 24 Jun 2014 08:01:30 -0700 (PDT) Received: from localhost.localdomain ([112.168.75.135]) by mx.google.com with ESMTPSA id h5sm800199pbw.81.2014.06.24.08.01.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jun 2014 08:01:30 -0700 (PDT) From: Sergey Senozhatsky To: Chris Mason Cc: Josef Bacik , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: [PATCH] btrfs compression: reuse recently used workspace Date: Wed, 25 Jun 2014 00:00:44 +0900 Message-Id: <1403622044-2964-2-git-send-email-sergey.senozhatsky@gmail.com> X-Mailer: git-send-email 2.0.0.548.ge727dec In-Reply-To: <1403622044-2964-1-git-send-email-sergey.senozhatsky@gmail.com> References: <1403622044-2964-1-git-send-email-sergey.senozhatsky@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: David Sterba --- fs/btrfs/compression.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 92371c4..1daea0b 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -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;