fix: cap thread pools at 64 and warn when clamped

- Limit read-thread-count, process-thread-count and the cor/cosr pool
  size in func.readdir to 64 threads per pool. Apply the cap after
  resolving automatic and CPU-divided counts; keep disabled process
  pools disabled and preserve the configured strings.
- Log a syslog warning identifying the setting and limit when clamped.
  For readdir, warn only when applying a valid concurrent policy,
  not during validation.
- Document the fixed cap and warning behavior. Queue depths retain
  their separate limits and use the clamped thread count.
- Resolve negative FUSE counts without overflowing on INT_MIN.

Document that both readdir inputs must fit in int and that a queue
depth whose product with the resolved thread count exceeds INT_MAX
is rejected, not clamped.
This commit is contained in:
Antonio SJ Musumeci 2026-11-21 17:48:28 -05:00
parent 8d93e29ad8
commit 127c2e6238
6 changed files with 80 additions and 21 deletions

View file

@ -3,6 +3,13 @@
There are multiple thread pools used in mergerfs to provide
parallel behaviors.
Each thread pool is limited to 64 threads. This applies to
`read-thread-count`, `process-thread-count` and the pool size in
[func.readdir](func_readdir.md). Counts resolved from automatic or
negative settings are also capped. When an applied setting exceeds
the limit, mergerfs reduces the count to 64 and logs a syslog warning
(`LOG_WARNING`). Queue depths are not capped to 64.
## read-thread-count