]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
smb/client: use binary search for SMB1 DOS/SRV error mapping
authorHuiwen He <hehuiwen@kylinos.cn>
Thu, 2 Apr 2026 14:18:37 +0000 (14:18 +0000)
committerSteve French <stfrench@microsoft.com>
Mon, 6 Apr 2026 00:58:40 +0000 (19:58 -0500)
commit95e6b7340957f8b51e6abb97c666eadd37f1f69f
tree95881eb383460b1dea11d903746cde83cad99e70
parent58ac796bb3c0f7b8295046404629724b68b40fa0
smb/client: use binary search for SMB1 DOS/SRV error mapping

Currently, map_smb_to_linux_error() uses linear searches for both
mapping_table_ERRDOS[] and mapping_table_ERRSRV[].

Refactor this by introducing search_mapping_table_ERRDOS() and
search_mapping_table_ERRSRV() that implements binary search(as the tables
are sorted).This improves lookup performance and reduces code duplication.

Also remove the sentinel entries from the mapping tables as they are no
longer needed with ARRAY_SIZE().

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smb1maperror.c