Commit 27feea1
committed
MDS/CDir: return as early as possible from CDir::should_split_fast()
All we want to know is whether we're above the `fast_limit`; if we're
above that, we don't need to know how many exactly.
By returning early instead of iterating over all entries, a lot of CPU
time can be saved. In a microbenchmark where `fio` was used to create
thousands of files, the CPU usage of `CDir::should_split_fast()` went
from 6% to less than 1% in the `perf report`.
Signed-off-by: Max Kellermann <[email protected]>1 parent c5faa93 commit 27feea1
1 file changed
+4
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3811 | 3811 | | |
3812 | 3812 | | |
3813 | 3813 | | |
| 3814 | + | |
| 3815 | + | |
| 3816 | + | |
3814 | 3817 | | |
3815 | 3818 | | |
3816 | 3819 | | |
3817 | | - | |
| 3820 | + | |
3818 | 3821 | | |
3819 | 3822 | | |
3820 | 3823 | | |
| |||
0 commit comments