Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3924977imu; Mon, 28 Jan 2019 13:26:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN6NBIBCBYX9Qu6ee+NAe69ByXr4R0dmUf5CKzX+ZA0iRd00B1LRJhLXwDoTXh3wL4SfRF10 X-Received: by 2002:a63:cd4c:: with SMTP id a12mr21637086pgj.252.1548710811967; Mon, 28 Jan 2019 13:26:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548710811; cv=none; d=google.com; s=arc-20160816; b=LnHvWhU/DoNZLk8PEhpLZYH1v0i9Pjf8Krwc7EIngFxiN9qSXhQQpQk6w9/25sVlh8 X2FT4BOouxFT3+Mn5yZabrzI0xjRXeRWNwklfDLvIh97zoLSb+qeuN83nJr9pTXvqPJg eazM1jCmIbzjFrmADQcNVjBY5IvXr0lPXaNoUWdpZZKAtAzE/zseA49QtYLwGev+52Ed lFktKkA5+2FxrZ3ltDVxNJRm0Ao2Xik3w0ajHvhQShaWt0VsTHtH3sZkzLrFt9cZWJBQ qqZCsUz4YjZe7kM/2hn5SdyCR+8sGFTEJTHQHPrYjA5v7Uj6YJUUHe9WVCrTfW23EQwY C8nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=/WAqu0DX/+VHR8/AR+fAyEvYgy44PedCWuNMUiZ3ZwQ=; b=dkynoVTvfpX+ZWWsHr8mLOcVlHkkjwWtcAUyGONyaodUnkt4hFcWvHa7j9RZH2PrSN w3uxmAAOhhJF3NMPNb57Ej3cn93npYiEMA6gBgrZ2rqimApO33+uYRgtotd6LxdcRdUN mWfDDnMLpOZ+kKMROCXT7krIwOLhgDBSlTB2idOgMsnRmGEhg0mnjD86fOH9aj3ccNvI 11Jl/aYlO1/uJnKh1B0nBQssj4kHyofOipbMx5D2Z9f2V0/k2NwWjWVd67kSjWISukly KSBZ59FNDJvH3ESeUv19P/8WqVBxIPYWa1DjPBvw3U2E9neoBdMW5V+KBYRxoFFoU5yB XPkQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b70si16589304pfe.168.2019.01.28.13.26.36; Mon, 28 Jan 2019 13:26:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728580AbfA1VZz (ORCPT + 99 others); Mon, 28 Jan 2019 16:25:55 -0500 Received: from mail-yb1-f194.google.com ([209.85.219.194]:39603 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728236AbfA1VYs (ORCPT ); Mon, 28 Jan 2019 16:24:48 -0500 Received: by mail-yb1-f194.google.com with SMTP id s17so7322686ybp.6; Mon, 28 Jan 2019 13:24:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/WAqu0DX/+VHR8/AR+fAyEvYgy44PedCWuNMUiZ3ZwQ=; b=d9MVOrVNgSX2INSgNVifINeWCR6i0NxJLibRPOyo4/eMoenFfEIFSybljD/QP1XZ0D RnF2FMxIrDxRMVkRd7xV/dKDglq91Cf/wNnMK5MIzuA1OfDwD2+U7i0jn9BIrXQTAsMJ 3QV3LMt9F6Ht3+HQ8hdLgx8Shr7uIJNk1mlwVbpO2SACLK/OTjCkfIEBsQ96vv7tftnP s61ufYwwlOe2oLK+BJyjd/oFR1qkP7K18W8IVVL4sl63A/aaL5YlBRka1XhONjocx8yb 35TaHJXS8TFwv9xBIunYTMkw0Cb/HE5gCfHgpNDpIiUn72fx1dIOzLqUOu4OXao/WNE+ IA9Q== X-Gm-Message-State: AHQUAua1EnbjB5KWOo5t1VKmTuhroDNqlWOcplL+log5B+6o8zjccA5n gjD+Js98cgIQgSoxYt8plGu1vv7Feyc= X-Received: by 2002:a25:414f:: with SMTP id o76mr6477935yba.159.1548710687582; Mon, 28 Jan 2019 13:24:47 -0800 (PST) Received: from dennisz-mbp.thefacebook.com ([199.201.65.135]) by smtp.gmail.com with ESMTPSA id a7sm24170415ywb.18.2019.01.28.13.24.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 13:24:46 -0800 (PST) From: Dennis Zhou To: David Sterba , Josef Bacik , Chris Mason , Omar Sandoval , Nick Terrell Cc: kernel-team@fb.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Dennis Zhou Subject: [PATCH 02/11] btrfs: rename workspaces_list to workspace_manager Date: Mon, 28 Jan 2019 16:24:28 -0500 Message-Id: <20190128212437.11597-3-dennis@kernel.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20190128212437.11597-1-dennis@kernel.org> References: <20190128212437.11597-1-dennis@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is in preparation for zstd compression levels. As each level will require different sized workspaces, workspaces_list is no longer a really fitting name. Signed-off-by: Dennis Zhou --- fs/btrfs/compression.c | 46 +++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 586f95ac0aea..aced261984e2 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -769,7 +769,7 @@ static struct list_head *alloc_heuristic_ws(void) return ERR_PTR(-ENOMEM); } -struct workspaces_list { +struct workspace_manager { struct list_head idle_ws; spinlock_t ws_lock; /* Number of free workspaces */ @@ -780,9 +780,9 @@ struct workspaces_list { wait_queue_head_t ws_wait; }; -static struct workspaces_list btrfs_comp_ws[BTRFS_COMPRESS_TYPES]; +static struct workspace_manager wsm[BTRFS_COMPRESS_TYPES]; -static struct workspaces_list btrfs_heuristic_ws; +static struct workspace_manager btrfs_heuristic_ws; static const struct btrfs_compress_op * const btrfs_compress_op[] = { &btrfs_zlib_compress, @@ -811,10 +811,10 @@ void __init btrfs_init_compress(void) } for (i = 0; i < BTRFS_COMPRESS_TYPES; i++) { - INIT_LIST_HEAD(&btrfs_comp_ws[i].idle_ws); - spin_lock_init(&btrfs_comp_ws[i].ws_lock); - atomic_set(&btrfs_comp_ws[i].total_ws, 0); - init_waitqueue_head(&btrfs_comp_ws[i].ws_wait); + INIT_LIST_HEAD(&wsm[i].idle_ws); + spin_lock_init(&wsm[i].ws_lock); + atomic_set(&wsm[i].total_ws, 0); + init_waitqueue_head(&wsm[i].ws_wait); /* * Preallocate one workspace for each compression type so @@ -824,9 +824,9 @@ void __init btrfs_init_compress(void) if (IS_ERR(workspace)) { pr_warn("BTRFS: cannot preallocate compression workspace, will try later\n"); } else { - atomic_set(&btrfs_comp_ws[i].total_ws, 1); - btrfs_comp_ws[i].free_ws = 1; - list_add(workspace, &btrfs_comp_ws[i].idle_ws); + atomic_set(&wsm[i].total_ws, 1); + wsm[i].free_ws = 1; + list_add(workspace, &wsm[i].idle_ws); } } } @@ -856,11 +856,11 @@ static struct list_head *__find_workspace(int type, bool heuristic) ws_wait = &btrfs_heuristic_ws.ws_wait; free_ws = &btrfs_heuristic_ws.free_ws; } else { - idle_ws = &btrfs_comp_ws[idx].idle_ws; - ws_lock = &btrfs_comp_ws[idx].ws_lock; - total_ws = &btrfs_comp_ws[idx].total_ws; - ws_wait = &btrfs_comp_ws[idx].ws_wait; - free_ws = &btrfs_comp_ws[idx].free_ws; + idle_ws = &wsm[idx].idle_ws; + ws_lock = &wsm[idx].ws_lock; + total_ws = &wsm[idx].total_ws; + ws_wait = &wsm[idx].ws_wait; + free_ws = &wsm[idx].free_ws; } again: @@ -952,11 +952,11 @@ static void __free_workspace(int type, struct list_head *workspace, ws_wait = &btrfs_heuristic_ws.ws_wait; free_ws = &btrfs_heuristic_ws.free_ws; } else { - idle_ws = &btrfs_comp_ws[idx].idle_ws; - ws_lock = &btrfs_comp_ws[idx].ws_lock; - total_ws = &btrfs_comp_ws[idx].total_ws; - ws_wait = &btrfs_comp_ws[idx].ws_wait; - free_ws = &btrfs_comp_ws[idx].free_ws; + idle_ws = &wsm[idx].idle_ws; + ws_lock = &wsm[idx].ws_lock; + total_ws = &wsm[idx].total_ws; + ws_wait = &wsm[idx].ws_wait; + free_ws = &wsm[idx].free_ws; } spin_lock(ws_lock); @@ -998,11 +998,11 @@ static void free_workspaces(void) } for (i = 0; i < BTRFS_COMPRESS_TYPES; i++) { - while (!list_empty(&btrfs_comp_ws[i].idle_ws)) { - workspace = btrfs_comp_ws[i].idle_ws.next; + while (!list_empty(&wsm[i].idle_ws)) { + workspace = wsm[i].idle_ws.next; list_del(workspace); btrfs_compress_op[i]->free_workspace(workspace); - atomic_dec(&btrfs_comp_ws[i].total_ws); + atomic_dec(&wsm[i].total_ws); } } } -- 2.17.1