]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: zstd: move zstd_parameters to the workspace
authorDavid Sterba <dsterba@suse.com>
Wed, 12 Feb 2025 20:22:02 +0000 (21:22 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 18 Mar 2025 19:35:42 +0000 (20:35 +0100)
commitcfb999b81aa6285db1ecf090346be46d53213384
tree5a99c20e4c2028afc159066c7f0cc17ed917d5f3
parenta8511baf321decd78320ba36c24c2ae11196a8b4
btrfs: zstd: move zstd_parameters to the workspace

Reduce stack consumption of zstd_compress_folios() by 40 bytes
(10*sizeof(int)) as we can store struct zstd_parameters in the workspace
that is reused for each call.

typedef struct {
ZSTD_compressionParameters cParams;
ZSTD_frameParameters fParams;
} ZSTD_parameters;

typedef struct {
    unsigned windowLog;
    unsigned chainLog;
    unsigned hashLog;
    unsigned searchLog;
    unsigned minMatch;
    unsigned targetLength;
    ZSTD_strategy strategy;
} ZSTD_compressionParameters;

typedef struct {
    int contentSizeFlag;
    int checksumFlag;
    int noDictIDFlag;
} ZSTD_frameParameters;

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/zstd.c