[PATCH 00/30] smb: improve search speed of SMB1 maperror

chenxiaosong.chenxiaosong@linux.dev posted 30 patches 1 week, 4 days ago
fs/smb/client/cifsfs.c       |    2 +
fs/smb/client/cifsproto.h    |    1 +
fs/smb/client/netmisc.c      |  155 ++++--
fs/smb/client/netmisc_test.c |  114 ++++
fs/smb/client/nterr.c        |   12 +-
fs/smb/client/nterr.h        | 1017 +++++++++++++++++-----------------
fs/smb/server/nterr.h        |  543 ------------------
fs/smb/server/smb2misc.c     |    1 -
fs/smb/server/smb_common.h   |    1 -
9 files changed, 739 insertions(+), 1107 deletions(-)
create mode 100644 fs/smb/client/netmisc_test.c
delete mode 100644 fs/smb/server/nterr.h
[PATCH 00/30] smb: improve search speed of SMB1 maperror
Posted by chenxiaosong.chenxiaosong@linux.dev 1 week, 4 days ago
From: ChenXiaoSong <chenxiaosong@kylinos.cn>

Before applying this patchset, the patchset ("smb: improve search speed of SMB2 maperror") must
be applied first, which introduces `CONFIG_SMB_KUNIT_TESTS` and avoids some conflicts in `fs/smb/client/cifsfs.c`:
https://chenxiaosong.com/lkml-improve-search-speed-of-smb2-maperror.html (Redirect to the LKML link)

When searching for the last element, the comparison counts are shown in the table below:

+--------------------+--------+--------+
|                    |Before  |After   |
|                    |Patchset|Patchset|
+--------------------+--------+--------+
| ntstatus_to_dos_map|   525  |    9   |
+--------------------+--------+--------+
|             nt_errs|   516  |    9   |
+--------------------+--------+--------+
|mapping_table_ERRDOS|    39  |    5   |
+--------------------+--------+--------+
|mapping_table_ERRSRV|    37  |    5   |
+--------------------+--------+--------+

ChenXiaoSong (30):
  smb/client: fix NT_STATUS_NO_DATA_DETECTED value
  smb/client: fix NT_STATUS_DEVICE_DOOR_OPEN value
  smb/client: fix NT_STATUS_UNABLE_TO_FREE_VM value
  smb/server: remove unused nterr.h
  smb/client: add 4 NT error code definitions
  smb/client: add parentheses to NT error code definitions containing
    bitwise OR operator
  smb/client: introduce DEFINE_CMP_FUNC()
  smb/client: sort ntstatus_to_dos_map array
  smb/client: create netmisc_test.c and introduce
    DEFINE_CHECK_SORT_FUNC()
  smb/client: introduce KUnit test to check sort result of
    ntstatus_to_dos_map array
  smb/client: introduce DEFINE_SEARCH_FUNC()
  smb/client: use bsearch() to find target in ntstatus_to_dos_map array
  smb/client: remove useless elements from ntstatus_to_dos_map array
  smb/client: introduce DEFINE_CHECK_SEARCH_FUNC()
  smb/client: introduce KUnit test to check search result of
    ntstatus_to_dos_map array
  smb/client: sort nt_errs array
  smb/client: introduce KUnit test to check sort result of nt_errs array
  smb/client: use bsearch() to find target in nt_errs array
  smb/client: remove useless elements from nt_errs array
  smb/client: introduce KUnit test to check search result of nt_errs
    array
  smb/client: sort mapping_table_ERRDOS array
  smb/client: introduce KUnit test to check sort result of
    mapping_table_ERRDOS array
  smb/client: use bsearch() to find target in mapping_table_ERRDOS array
  smb/client: remove useless elements from mapping_table_ERRDOS array
  smb/client: introduce KUnit test to check search result of
    mapping_table_ERRDOS array
  smb/client: sort mapping_table_ERRSRV array
  smb/client: introduce KUnit test to check sort result of
    mapping_table_ERRSRV array
  smb/client: use bsearch() to find target in mapping_table_ERRSRV array
  smb/client: remove useless elements from mapping_table_ERRSRV array
  smb/client: introduce KUnit test to check search result of
    mapping_table_ERRSRV array

 fs/smb/client/cifsfs.c       |    2 +
 fs/smb/client/cifsproto.h    |    1 +
 fs/smb/client/netmisc.c      |  155 ++++--
 fs/smb/client/netmisc_test.c |  114 ++++
 fs/smb/client/nterr.c        |   12 +-
 fs/smb/client/nterr.h        | 1017 +++++++++++++++++-----------------
 fs/smb/server/nterr.h        |  543 ------------------
 fs/smb/server/smb2misc.c     |    1 -
 fs/smb/server/smb_common.h   |    1 -
 9 files changed, 739 insertions(+), 1107 deletions(-)
 create mode 100644 fs/smb/client/netmisc_test.c
 delete mode 100644 fs/smb/server/nterr.h

-- 
2.43.0
Re: [PATCH 00/30] smb: improve search speed of SMB1 maperror
Posted by ChenXiaoSong 1 week, 2 days ago
Hi Steve and Namjae,

I have tested all patches using KUnit tests, xfstests, and smbtorture, 
and no additional test failures were observed. The detailed test results 
can be found in: https://chenxiaosong.com/en/smb-test-20251210.html

For more detailed information about the patches to be reviewed, please 
see the link: https://chenxiaosong.com/en/smb-patch.html

Thanks,
ChenXiaoSong.

On 12/8/25 14:20, chenxiaosong.chenxiaosong@linux.dev wrote:
> From: ChenXiaoSong <chenxiaosong@kylinos.cn>
> 
> Before applying this patchset, the patchset ("smb: improve search speed of SMB2 maperror") must
> be applied first, which introduces `CONFIG_SMB_KUNIT_TESTS` and avoids some conflicts in `fs/smb/client/cifsfs.c`:
> https://chenxiaosong.com/lkml-improve-search-speed-of-smb2-maperror.html (Redirect to the LKML link)
> 
> When searching for the last element, the comparison counts are shown in the table below:
> 
> +--------------------+--------+--------+
> |                    |Before  |After   |
> |                    |Patchset|Patchset|
> +--------------------+--------+--------+
> | ntstatus_to_dos_map|   525  |    9   |
> +--------------------+--------+--------+
> |             nt_errs|   516  |    9   |
> +--------------------+--------+--------+
> |mapping_table_ERRDOS|    39  |    5   |
> +--------------------+--------+--------+
> |mapping_table_ERRSRV|    37  |    5   |
> +--------------------+--------+--------+
> 
> ChenXiaoSong (30):
>    smb/client: fix NT_STATUS_NO_DATA_DETECTED value
>    smb/client: fix NT_STATUS_DEVICE_DOOR_OPEN value
>    smb/client: fix NT_STATUS_UNABLE_TO_FREE_VM value
>    smb/server: remove unused nterr.h
>    smb/client: add 4 NT error code definitions
>    smb/client: add parentheses to NT error code definitions containing
>      bitwise OR operator
>    smb/client: introduce DEFINE_CMP_FUNC()
>    smb/client: sort ntstatus_to_dos_map array
>    smb/client: create netmisc_test.c and introduce
>      DEFINE_CHECK_SORT_FUNC()
>    smb/client: introduce KUnit test to check sort result of
>      ntstatus_to_dos_map array
>    smb/client: introduce DEFINE_SEARCH_FUNC()
>    smb/client: use bsearch() to find target in ntstatus_to_dos_map array
>    smb/client: remove useless elements from ntstatus_to_dos_map array
>    smb/client: introduce DEFINE_CHECK_SEARCH_FUNC()
>    smb/client: introduce KUnit test to check search result of
>      ntstatus_to_dos_map array
>    smb/client: sort nt_errs array
>    smb/client: introduce KUnit test to check sort result of nt_errs array
>    smb/client: use bsearch() to find target in nt_errs array
>    smb/client: remove useless elements from nt_errs array
>    smb/client: introduce KUnit test to check search result of nt_errs
>      array
>    smb/client: sort mapping_table_ERRDOS array
>    smb/client: introduce KUnit test to check sort result of
>      mapping_table_ERRDOS array
>    smb/client: use bsearch() to find target in mapping_table_ERRDOS array
>    smb/client: remove useless elements from mapping_table_ERRDOS array
>    smb/client: introduce KUnit test to check search result of
>      mapping_table_ERRDOS array
>    smb/client: sort mapping_table_ERRSRV array
>    smb/client: introduce KUnit test to check sort result of
>      mapping_table_ERRSRV array
>    smb/client: use bsearch() to find target in mapping_table_ERRSRV array
>    smb/client: remove useless elements from mapping_table_ERRSRV array
>    smb/client: introduce KUnit test to check search result of
>      mapping_table_ERRSRV array
> 
>   fs/smb/client/cifsfs.c       |    2 +
>   fs/smb/client/cifsproto.h    |    1 +
>   fs/smb/client/netmisc.c      |  155 ++++--
>   fs/smb/client/netmisc_test.c |  114 ++++
>   fs/smb/client/nterr.c        |   12 +-
>   fs/smb/client/nterr.h        | 1017 +++++++++++++++++-----------------
>   fs/smb/server/nterr.h        |  543 ------------------
>   fs/smb/server/smb2misc.c     |    1 -
>   fs/smb/server/smb_common.h   |    1 -
>   9 files changed, 739 insertions(+), 1107 deletions(-)
>   create mode 100644 fs/smb/client/netmisc_test.c
>   delete mode 100644 fs/smb/server/nterr.h
>
Re: [PATCH 00/30] smb: improve search speed of SMB1 maperror
Posted by Steve French 1 week, 2 days ago
Merged nine of the client patches from this series into cifs-2.6.git
for-next.  They looked safe.  Good catch on fixing some of these
incorrect error definitions.

a691ac0cdd97 (HEAD -> for-next, origin/for-next) smb: move
file_notify_information to common/fscc.h
c0fd2fbe4f73 smb: move SMB2 Notify Action Flags into common/smb2pdu.h
787a2b803211 smb: move notify completion filter flags into common/smb2pdu.h
14a6f0e19fc7 smb/client: add parentheses to NT error code definitions
containing bitwise OR operator
1e4c7c9ab176 smb: add documentation references for smb2 change notify
definitions
833f0f46368f smb/client: add 4 NT error code definitions
3a0a34572269 smb/client: fix NT_STATUS_UNABLE_TO_FREE_VM value
954cbce76316 smb/client: fix NT_STATUS_DEVICE_DOOR_OPEN value
b9695d00b605 smb/client: fix NT_STATUS_NO_DATA_DETECTED value
3d99347a2e1a (linus/master, linus/HEAD) Merge tag
'v6.19-rc-part1-smb3-client-fixes' of
git://git.samba.org/sfrench/cifs-2.6

On Mon, Dec 8, 2025 at 12:22 AM <chenxiaosong.chenxiaosong@linux.dev> wrote:
>
> From: ChenXiaoSong <chenxiaosong@kylinos.cn>
>
> Before applying this patchset, the patchset ("smb: improve search speed of SMB2 maperror") must
> be applied first, which introduces `CONFIG_SMB_KUNIT_TESTS` and avoids some conflicts in `fs/smb/client/cifsfs.c`:
> https://chenxiaosong.com/lkml-improve-search-speed-of-smb2-maperror.html (Redirect to the LKML link)
>
> When searching for the last element, the comparison counts are shown in the table below:
>
> +--------------------+--------+--------+
> |                    |Before  |After   |
> |                    |Patchset|Patchset|
> +--------------------+--------+--------+
> | ntstatus_to_dos_map|   525  |    9   |
> +--------------------+--------+--------+
> |             nt_errs|   516  |    9   |
> +--------------------+--------+--------+
> |mapping_table_ERRDOS|    39  |    5   |
> +--------------------+--------+--------+
> |mapping_table_ERRSRV|    37  |    5   |
> +--------------------+--------+--------+
>
> ChenXiaoSong (30):
>   smb/client: fix NT_STATUS_NO_DATA_DETECTED value
>   smb/client: fix NT_STATUS_DEVICE_DOOR_OPEN value
>   smb/client: fix NT_STATUS_UNABLE_TO_FREE_VM value
>   smb/server: remove unused nterr.h
>   smb/client: add 4 NT error code definitions
>   smb/client: add parentheses to NT error code definitions containing
>     bitwise OR operator
>   smb/client: introduce DEFINE_CMP_FUNC()
>   smb/client: sort ntstatus_to_dos_map array
>   smb/client: create netmisc_test.c and introduce
>     DEFINE_CHECK_SORT_FUNC()
>   smb/client: introduce KUnit test to check sort result of
>     ntstatus_to_dos_map array
>   smb/client: introduce DEFINE_SEARCH_FUNC()
>   smb/client: use bsearch() to find target in ntstatus_to_dos_map array
>   smb/client: remove useless elements from ntstatus_to_dos_map array
>   smb/client: introduce DEFINE_CHECK_SEARCH_FUNC()
>   smb/client: introduce KUnit test to check search result of
>     ntstatus_to_dos_map array
>   smb/client: sort nt_errs array
>   smb/client: introduce KUnit test to check sort result of nt_errs array
>   smb/client: use bsearch() to find target in nt_errs array
>   smb/client: remove useless elements from nt_errs array
>   smb/client: introduce KUnit test to check search result of nt_errs
>     array
>   smb/client: sort mapping_table_ERRDOS array
>   smb/client: introduce KUnit test to check sort result of
>     mapping_table_ERRDOS array
>   smb/client: use bsearch() to find target in mapping_table_ERRDOS array
>   smb/client: remove useless elements from mapping_table_ERRDOS array
>   smb/client: introduce KUnit test to check search result of
>     mapping_table_ERRDOS array
>   smb/client: sort mapping_table_ERRSRV array
>   smb/client: introduce KUnit test to check sort result of
>     mapping_table_ERRSRV array
>   smb/client: use bsearch() to find target in mapping_table_ERRSRV array
>   smb/client: remove useless elements from mapping_table_ERRSRV array
>   smb/client: introduce KUnit test to check search result of
>     mapping_table_ERRSRV array
>
>  fs/smb/client/cifsfs.c       |    2 +
>  fs/smb/client/cifsproto.h    |    1 +
>  fs/smb/client/netmisc.c      |  155 ++++--
>  fs/smb/client/netmisc_test.c |  114 ++++
>  fs/smb/client/nterr.c        |   12 +-
>  fs/smb/client/nterr.h        | 1017 +++++++++++++++++-----------------
>  fs/smb/server/nterr.h        |  543 ------------------
>  fs/smb/server/smb2misc.c     |    1 -
>  fs/smb/server/smb_common.h   |    1 -
>  9 files changed, 739 insertions(+), 1107 deletions(-)
>  create mode 100644 fs/smb/client/netmisc_test.c
>  delete mode 100644 fs/smb/server/nterr.h
>
> --
> 2.43.0
>


-- 
Thanks,

Steve
Re: [PATCH 00/30] smb: improve search speed of SMB1 maperror
Posted by ChenXiaoSong 1 week, 2 days ago
Hi Steve and Namjae,

I have updated the list of patches that have not been merged yet: 
https://chenxiaosong.com/en/smb-patch.html

I will provide the test results for these patches today.

Thanks,
ChenXiaoSong.

On 12/10/25 07:41, Steve French wrote:
> Merged nine of the client patches from this series into cifs-2.6.git
> for-next.  They looked safe.  Good catch on fixing some of these
> incorrect error definitions.
> 
> a691ac0cdd97 (HEAD -> for-next, origin/for-next) smb: move
> file_notify_information to common/fscc.h
> c0fd2fbe4f73 smb: move SMB2 Notify Action Flags into common/smb2pdu.h
> 787a2b803211 smb: move notify completion filter flags into common/smb2pdu.h
> 14a6f0e19fc7 smb/client: add parentheses to NT error code definitions
> containing bitwise OR operator
> 1e4c7c9ab176 smb: add documentation references for smb2 change notify
> definitions
> 833f0f46368f smb/client: add 4 NT error code definitions
> 3a0a34572269 smb/client: fix NT_STATUS_UNABLE_TO_FREE_VM value
> 954cbce76316 smb/client: fix NT_STATUS_DEVICE_DOOR_OPEN value
> b9695d00b605 smb/client: fix NT_STATUS_NO_DATA_DETECTED value
> 3d99347a2e1a (linus/master, linus/HEAD) Merge tag
> 'v6.19-rc-part1-smb3-client-fixes' of
> git://git.samba.org/sfrench/cifs-2.6
> 
> On Mon, Dec 8, 2025 at 12:22 AM <chenxiaosong.chenxiaosong@linux.dev> wrote:
>>
>> From: ChenXiaoSong <chenxiaosong@kylinos.cn>
>>
>> Before applying this patchset, the patchset ("smb: improve search speed of SMB2 maperror") must
>> be applied first, which introduces `CONFIG_SMB_KUNIT_TESTS` and avoids some conflicts in `fs/smb/client/cifsfs.c`:
>> https://chenxiaosong.com/lkml-improve-search-speed-of-smb2-maperror.html (Redirect to the LKML link)
>>
>> When searching for the last element, the comparison counts are shown in the table below:
>>
>> +--------------------+--------+--------+
>> |                    |Before  |After   |
>> |                    |Patchset|Patchset|
>> +--------------------+--------+--------+
>> | ntstatus_to_dos_map|   525  |    9   |
>> +--------------------+--------+--------+
>> |             nt_errs|   516  |    9   |
>> +--------------------+--------+--------+
>> |mapping_table_ERRDOS|    39  |    5   |
>> +--------------------+--------+--------+
>> |mapping_table_ERRSRV|    37  |    5   |
>> +--------------------+--------+--------+
>>
>> ChenXiaoSong (30):
>>    smb/client: fix NT_STATUS_NO_DATA_DETECTED value
>>    smb/client: fix NT_STATUS_DEVICE_DOOR_OPEN value
>>    smb/client: fix NT_STATUS_UNABLE_TO_FREE_VM value
>>    smb/server: remove unused nterr.h
>>    smb/client: add 4 NT error code definitions
>>    smb/client: add parentheses to NT error code definitions containing
>>      bitwise OR operator
>>    smb/client: introduce DEFINE_CMP_FUNC()
>>    smb/client: sort ntstatus_to_dos_map array
>>    smb/client: create netmisc_test.c and introduce
>>      DEFINE_CHECK_SORT_FUNC()
>>    smb/client: introduce KUnit test to check sort result of
>>      ntstatus_to_dos_map array
>>    smb/client: introduce DEFINE_SEARCH_FUNC()
>>    smb/client: use bsearch() to find target in ntstatus_to_dos_map array
>>    smb/client: remove useless elements from ntstatus_to_dos_map array
>>    smb/client: introduce DEFINE_CHECK_SEARCH_FUNC()
>>    smb/client: introduce KUnit test to check search result of
>>      ntstatus_to_dos_map array
>>    smb/client: sort nt_errs array
>>    smb/client: introduce KUnit test to check sort result of nt_errs array
>>    smb/client: use bsearch() to find target in nt_errs array
>>    smb/client: remove useless elements from nt_errs array
>>    smb/client: introduce KUnit test to check search result of nt_errs
>>      array
>>    smb/client: sort mapping_table_ERRDOS array
>>    smb/client: introduce KUnit test to check sort result of
>>      mapping_table_ERRDOS array
>>    smb/client: use bsearch() to find target in mapping_table_ERRDOS array
>>    smb/client: remove useless elements from mapping_table_ERRDOS array
>>    smb/client: introduce KUnit test to check search result of
>>      mapping_table_ERRDOS array
>>    smb/client: sort mapping_table_ERRSRV array
>>    smb/client: introduce KUnit test to check sort result of
>>      mapping_table_ERRSRV array
>>    smb/client: use bsearch() to find target in mapping_table_ERRSRV array
>>    smb/client: remove useless elements from mapping_table_ERRSRV array
>>    smb/client: introduce KUnit test to check search result of
>>      mapping_table_ERRSRV array
>>
>>   fs/smb/client/cifsfs.c       |    2 +
>>   fs/smb/client/cifsproto.h    |    1 +
>>   fs/smb/client/netmisc.c      |  155 ++++--
>>   fs/smb/client/netmisc_test.c |  114 ++++
>>   fs/smb/client/nterr.c        |   12 +-
>>   fs/smb/client/nterr.h        | 1017 +++++++++++++++++-----------------
>>   fs/smb/server/nterr.h        |  543 ------------------
>>   fs/smb/server/smb2misc.c     |    1 -
>>   fs/smb/server/smb_common.h   |    1 -
>>   9 files changed, 739 insertions(+), 1107 deletions(-)
>>   create mode 100644 fs/smb/client/netmisc_test.c
>>   delete mode 100644 fs/smb/server/nterr.h
>>
>> --
>> 2.43.0
>>
> 
>