Commit 25ced46
committed
lookup without holding the lock during registration
global_lock is a source of contention when multiple threads/cores
are adding stats concurrently, e.g. when a volume is being created
so every core has to create a set of volume stats.
This contention is mostly redundant as every directory in the root
and the entire sub-tree under it is only modified by the core
that owns it.
While a better solution would be to have a separate lock for each
of these sub-trees, we can reduce the contention by holding the lock
for a shorter period of time.
One of the suspected long locked periods is lookup for duplicate
entry done in register_item(): this walks the list, which is O(N)
and can be expensive for the "namespaces" directory with 10K entries.
Based on the above, we lookup for duplicates without holding a lock,
unless looking up in the root directory.
List modification as well as item initialization is still done under lock
to make sure the fuse interface always finds the directory and the
item in a consistent state.
Issue: LBM1-19873
Signed-off-by: Anton Eidelman <anton@lightbitslabs.com>1 parent 2723db2 commit 25ced46
1 file changed
+19
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
779 | 779 | | |
780 | 780 | | |
781 | 781 | | |
782 | | - | |
783 | | - | |
| 782 | + | |
784 | 783 | | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
785 | 791 | | |
786 | 792 | | |
787 | | - | |
788 | | - | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
789 | 796 | | |
790 | 797 | | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
791 | 802 | | |
| 803 | + | |
| 804 | + | |
792 | 805 | | |
| 806 | + | |
| 807 | + | |
793 | 808 | | |
794 | 809 | | |
795 | 810 | | |
| |||
0 commit comments