]> www.infradead.org Git - users/willy/xarray.git/commit
smb: client: fix compression heuristic functions
authorEnzo Matsumiya <ematsumiya@suse.de>
Mon, 16 Sep 2024 16:30:49 +0000 (13:30 -0300)
committerSteve French <stfrench@microsoft.com>
Tue, 17 Sep 2024 01:10:39 +0000 (20:10 -0500)
commit5ac1f99fdd09d80223e8f47dffaea41a6563aace
treed8c4bea7ef360eefb35f2d5d2e3d3ce64176a97f
parent37408843f2ae03b027777f2ffa460e2eb0f3b292
smb: client: fix compression heuristic functions

Change is_compressible() return type to bool, use WARN_ON_ONCE(1) for
internal errors and return false for those.

Renames:
check_repeated_data -> has_repeated_data
check_ascii_bytes -> is_mostly_ascii (also refactor into a single loop)
calc_shannon_entropy -> has_low_entropy

Also wraps "wreq->Length" in le32_to_cpu() in should_compress() (caught
by sparse).

Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/compress.c