mbox series

[00/15] Remove callback indirections in compression code

Message ID cover.1571054758.git.dsterba@suse.com (mailing list archive)
Headers show
Series Remove callback indirections in compression code | expand

Message

David Sterba Oct. 14, 2019, 12:22 p.m. UTC
The series removes all per-compression algorithm callbacks and replaces
them with a switches. Lots of indirections are simplified and while it
looks nice from design POV, we don't need to over-engineer it as we have
only fixed known number of the users and not public API.

The cost of indirect function calls is also higher with enabled
mitigations of the spectre vulnerability, so they've been incrementally
removed from the whole kernel and from btrfs as well.

David Sterba (15):
  btrfs: export compression and decompression callbacks
  btrfs: switch compression callbacks to direct calls
  btrfs: compression: attach workspace manager to the ops
  btrfs: compression: let workspace manager init take only the type
  btrfs: compression: inline init_workspace_manager
  btrfs: compression: let workspace manager cleanup take only the type
  btrfs: compression: inline cleanup_workspace_manager
  btrfs: compression: export alloc/free/get/put callbacks of all algos
  btrfs: compression: inline get_workspace
  btrfs: compression: inline put_workspace
  btrfs: compression: pass type to btrfs_get_workspace
  btrfs: compression: inline alloc_workspace
  btrfs: compression: pass type to btrfs_put_workspace
  btrfs: compression: inline free_workspace
  btrfs: compression: remove ops pointer from workspace_manager

 fs/btrfs/compression.c | 241 +++++++++++++++++++++++++++++++----------
 fs/btrfs/compression.h |  39 +------
 fs/btrfs/lzo.c         |  53 ++-------
 fs/btrfs/zlib.c        |  52 ++-------
 fs/btrfs/zstd.c        |  47 +++-----
 5 files changed, 227 insertions(+), 205 deletions(-)

Comments

Nikolay Borisov Oct. 17, 2019, 3:02 p.m. UTC | #1
On 14.10.19 г. 15:22 ч., David Sterba wrote:
> The series removes all per-compression algorithm callbacks and replaces
> them with a switches. Lots of indirections are simplified and while it
> looks nice from design POV, we don't need to over-engineer it as we have
> only fixed known number of the users and not public API.
> 
> The cost of indirect function calls is also higher with enabled
> mitigations of the spectre vulnerability, so they've been incrementally
> removed from the whole kernel and from btrfs as well.
> 
> David Sterba (15):
>   btrfs: export compression and decompression callbacks
>   btrfs: switch compression callbacks to direct calls
>   btrfs: compression: attach workspace manager to the ops
>   btrfs: compression: let workspace manager init take only the type
>   btrfs: compression: inline init_workspace_manager
>   btrfs: compression: let workspace manager cleanup take only the type
>   btrfs: compression: inline cleanup_workspace_manager
>   btrfs: compression: export alloc/free/get/put callbacks of all algos
>   btrfs: compression: inline get_workspace
>   btrfs: compression: inline put_workspace
>   btrfs: compression: pass type to btrfs_get_workspace
>   btrfs: compression: inline alloc_workspace
>   btrfs: compression: pass type to btrfs_put_workspace
>   btrfs: compression: inline free_workspace
>   btrfs: compression: remove ops pointer from workspace_manager
> 
>  fs/btrfs/compression.c | 241 +++++++++++++++++++++++++++++++----------
>  fs/btrfs/compression.h |  39 +------
>  fs/btrfs/lzo.c         |  53 ++-------
>  fs/btrfs/zlib.c        |  52 ++-------
>  fs/btrfs/zstd.c        |  47 +++-----
>  5 files changed, 227 insertions(+), 205 deletions(-)

The whole series look good.

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

>
David Sterba Oct. 17, 2019, 6:19 p.m. UTC | #2
On Mon, Oct 14, 2019 at 02:22:21PM +0200, David Sterba wrote:
> The series removes all per-compression algorithm callbacks and replaces
> them with a switches. Lots of indirections are simplified and while it
> looks nice from design POV, we don't need to over-engineer it as we have
> only fixed known number of the users and not public API.
> 
> The cost of indirect function calls is also higher with enabled
> mitigations of the spectre vulnerability, so they've been incrementally
> removed from the whole kernel and from btrfs as well.
> 
> David Sterba (15):
>   btrfs: export compression and decompression callbacks
>   btrfs: switch compression callbacks to direct calls
>   btrfs: compression: attach workspace manager to the ops
>   btrfs: compression: let workspace manager init take only the type
>   btrfs: compression: inline init_workspace_manager
>   btrfs: compression: let workspace manager cleanup take only the type
>   btrfs: compression: inline cleanup_workspace_manager
>   btrfs: compression: export alloc/free/get/put callbacks of all algos
>   btrfs: compression: inline get_workspace
>   btrfs: compression: inline put_workspace
>   btrfs: compression: pass type to btrfs_get_workspace
>   btrfs: compression: inline alloc_workspace
>   btrfs: compression: pass type to btrfs_put_workspace
>   btrfs: compression: inline free_workspace
>   btrfs: compression: remove ops pointer from workspace_manager

Added to misc-next.