Re: [PATCH 07/11] btrfs: move to fn pointers for get/put workspaces

Josef Bacik
2019-01-29T18:44:32Z

On Tue, Jan 29, 2019 at 01:17:17PM -0500, Josef Bacik wrote:
> On Mon, Jan 28, 2019 at 04:24:33PM -0500, Dennis Zhou wrote:
> > The previous patch added generic helpers for get_workspace() and
> > put_workspace(). Now, we can migrate ownership of the workspace_manager
> > to be in the compression type code as the compression code itself
> > doesn't care beyond being able to get a workspace. The init/cleanup
> > and get/put methods are abstracted so each compression algorithm can
> > decide how they want to manage their workspaces.
> >
> > Signed-off-by: Dennis Zhou <dennis@kernel.org>
>
> We're doing this to have special handling for extra workspaces to be free'd at
> some point in the future if they are unused. This is fine by me, but why not
> just add a shrinker and let it be handled by memory pressure? Then we avoid all
> this abstraction and allow for ztsd to have its shrinker for its extra
> workspaces. You can even use the list_lru stuff to make it super simple, then
> you don't have to worry about all the infrastructure. Thanks,
>

Nevermind, I missed that you also change the get side to lookup the workspace
for the compression level instead of cycling through the idle_ws list. In that
case this is fine by me.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef