Linux-BTRFS Archive on lore.kernel.org
 help / color / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Dennis Zhou <dennis@kernel.org>, David Sterba <dsterba@suse.com>,
	Josef Bacik <josef@toxicpanda.com>, Chris Mason <clm@fb.com>,
	Omar Sandoval <osandov@osandov.com>,
	Nick Terrell <terrelln@fb.com>
Cc: kernel-team@fb.com, linux-btrfs@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 02/11] btrfs: rename workspaces_list to workspace_manager
Date: Tue, 29 Jan 2019 09:27:22 +0200
Message-ID: <bd650df2-4920-9609-ad48-f4356bbdab7e@suse.com> (raw)
In-Reply-To: <20190128212437.11597-3-dennis@kernel.org>



On 28.01.19 г. 23:24 ч., Dennis Zhou wrote:
> 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 <dennis@kernel.org>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  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);
>  		}
>  	}
>  }
> 

  reply index

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-28 21:24 [PATCH 00/11] btrfs: add zstd compression level support Dennis Zhou
2019-01-28 21:24 ` [PATCH 01/11] btrfs: add macros for compression type and level Dennis Zhou
2019-01-29  7:26   ` Nikolay Borisov
2019-01-29 17:57   ` Josef Bacik
2019-01-29 22:30   ` Omar Sandoval
2019-01-31 16:00   ` David Sterba
2019-01-31 16:17     ` Dennis Zhou
2019-01-28 21:24 ` [PATCH 02/11] btrfs: rename workspaces_list to workspace_manager Dennis Zhou
2019-01-29  7:27   ` Nikolay Borisov [this message]
2019-01-29 17:58   ` Josef Bacik
2019-01-28 21:24 ` [PATCH 03/11] btrfs: manage heuristic workspace as index 0 Dennis Zhou
2019-01-29  7:53   ` Nikolay Borisov
2019-01-29 22:43     ` Dennis Zhou
2019-01-29 18:02   ` Josef Bacik
2019-01-31 16:10   ` David Sterba
2019-01-28 21:24 ` [PATCH 04/11] btrfs: unify compression ops with workspace_manager Dennis Zhou
2019-01-29  7:54   ` Nikolay Borisov
2019-01-29 18:03   ` Josef Bacik
2019-01-28 21:24 ` [PATCH 05/11] btrfs: add helper methods for workspace manager init and cleanup Dennis Zhou
2019-01-29  7:58   ` Nikolay Borisov
2019-01-29 18:04   ` Josef Bacik
2019-01-28 21:24 ` [PATCH 06/11] btrfs: add compression interface in (get/put)_workspace() Dennis Zhou
2019-01-29 18:06   ` Josef Bacik
2019-01-28 21:24 ` [PATCH 07/11] btrfs: move to fn pointers for get/put workspaces Dennis Zhou
2019-01-29  8:22   ` Nikolay Borisov
2019-01-29 23:35     ` Dennis Zhou
2019-01-29 18:17   ` Josef Bacik
2019-01-29 18:44     ` Josef Bacik
2019-01-28 21:24 ` [PATCH 08/11] btrfs: plumb level through the compression interface Dennis Zhou
2019-01-29  8:08   ` Nikolay Borisov
2019-01-29 18:17   ` Josef Bacik
2019-01-28 21:24 ` [PATCH 09/11] btrfs: change set_level() to bound the level passed in Dennis Zhou
2019-01-29  8:14   ` Nikolay Borisov
2019-01-30 22:06     ` Dennis Zhou
2019-01-28 21:24 ` [PATCH 10/11] btrfs: zstd use the passed through level instead of default Dennis Zhou
2019-01-29  8:15   ` Nikolay Borisov
2019-01-28 21:24 ` [PATCH 11/11] btrfs: add zstd compression level support Dennis Zhou
2019-01-29  7:25   ` Nikolay Borisov
2019-01-29 22:50     ` Dennis Zhou
2019-01-31 18:10   ` David Sterba
2019-01-31 18:13   ` David Sterba
2019-01-29 17:18 ` [PATCH 00/11] " David Sterba
2019-01-29 21:12   ` Nick Terrell
2019-01-30 17:40   ` Dennis Zhou
2019-01-31 14:04     ` David Sterba
2019-01-31 15:56       ` Dennis Zhou

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd650df2-4920-9609-ad48-f4356bbdab7e@suse.com \
    --to=nborisov@suse.com \
    --cc=clm@fb.com \
    --cc=dennis@kernel.org \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=osandov@osandov.com \
    --cc=terrelln@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-BTRFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-btrfs/0 linux-btrfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-btrfs linux-btrfs/ https://lore.kernel.org/linux-btrfs \
		linux-btrfs@vger.kernel.org linux-btrfs@archiver.kernel.org
	public-inbox-index linux-btrfs


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-btrfs


AGPL code for this site: git clone https://public-inbox.org/ public-inbox