[PATCH v2 14/14] smb: client: mark compression as supported on 64-bit LE only
Enzo Matsumiya <[email protected]> Mon, 20 Jul 2026 16:49:25 -0300
| Newsgroups | org.kernel.vger.linux-cifs |
|---|---|
| Message-ID | <[email protected]> |
Other architectures require more tuning + tests, even more so to maintain the same performance. So for now, mark SMB2 compression as supported only on 64-bit little endian architectures. Signed-off-by: Enzo Matsumiya <[email protected]> --- fs/smb/client/fs_context.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c index abc29500a664..05aceb5652a9 100644 --- a/fs/smb/client/fs_context.c +++ b/fs/smb/client/fs_context.c @@ -1248,6 +1248,22 @@ static int smb3_reconfigure(struct fs_context *fc) return rc; } +/* + * Current SMB2 compression code works best, or at all, only in 64-bit little endian architectures. + * + * (this is more of a "TODO" than a final statement for other archs) + */ +static inline bool smb_compress_arch_supported(void) +{ +#if BITS_PER_LONG == 64 && (defined(__LITTLE_ENDIAN) || \ + (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \ + __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) + return true; +#else + return false; +#endif +} + static int smb3_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param) { @@ -1289,8 +1305,13 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, cifs_errorf(fc, "CONFIG_CIFS_COMPRESSION kernel config option is unset\n"); goto cifs_parse_mount_err; } - ctx->compress = true; - cifs_dbg(VFS, "SMB3 compression support is experimental\n"); + + if (smb_compress_arch_supported()) { + ctx->compress = true; + cifs_dbg(VFS, "SMB3 compression support is experimental\n"); + } else { + cifs_dbg(VFS, "SMB3 compression is currently only supported on 64-bit little endian architectures, not enabling\n"); + } break; case Opt_nodfs: ctx->nodfs = 1; -- 2.54.0