mount: optimize mountinfo traversal by decoupling device discovery
authorChen Guanqiao <chen.chenchacha@foxmail.com>
Wed, 2 Oct 2024 05:10:21 +0000 (13:10 +0800)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 8 Oct 2024 21:36:59 +0000 (22:36 +0100)
commit00ad3f02275b507a753495ace5e5f84cb38b604d
treedceb7c06540b440d04857f53ac20490058ec796e
parent2b577d598bbae6ee8f615be96a98934fe6e4c24a
mount: optimize mountinfo traversal by decoupling device discovery

In mount_load_proc_self_mountinfo(), device_found_node() is synchronously called
during the traversal of mountinfo entries. When there are a large number of
mount points, and the device types are not significantly different, this results
in excessive time consumption during device discovery, causing a performance
bottleneck. This issue is particularly prominent on servers with a large number
of cores in IDC.

This patch decouples device discovery from the mountinfo traversal process,
avoiding redundant device operations. As a result, it significantly improves
performance, especially in environments with numerous mount points.

Signed-off-by: Chen Guanqiao <chen.chenchacha@foxmail.com>
src/core/mount.c