]> git.ipfire.org Git - thirdparty/linux.git/commit
smb/client: use bsearch() to find target in smb2_error_map_table
authorChenXiaoSong <chenxiaosong@kylinos.cn>
Tue, 23 Dec 2025 09:24:40 +0000 (17:24 +0800)
committerSteve French <stfrench@microsoft.com>
Mon, 9 Feb 2026 03:24:41 +0000 (21:24 -0600)
commit75563adbb91d9d199b33f8b9a2fe4e9cafea6a69
tree9ef5e588e00c43b4da0092bbdfd8746b1abdf8d9
parent453382f15b0e9b74fc83d364ffa68fa5e4806485
smb/client: use bsearch() to find target in smb2_error_map_table

The smb2_error_map_table array currently has 1740 elements. When searching
for the last element, the original loop-based search method requires 1740
comparisons, while binary search algorithm requires only 10 comparisons.

Suggested-by: David Howells <dhowells@redhat.com>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Reviewed-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/linux-cifs/20260106071507.1420900-5-chenxiaosong.chenxiaosong@linux.dev/
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smb2maperror.c