treewide: replace deprecated smp::count and smp::all_cpus() with new APIs

Replace all uses of the deprecated seastar::smp::count with
this_smp_shard_count() and smp::all_cpus() with this_smp_all_shards()
across the ScyllaDB codebase (seastar submodule untouched).

Both replacement functions require a reactor thread context. All call
sites were verified to run on reactor threads.

Notable cases:
- dht/token-sharding.hh: this_smp_shard_count() is used as a default
  parameter value. This is safe since all callers are on reactor threads,
  but the expression is now evaluated at each call site rather than being
  a reference to a global variable.
- service/storage_service.hh, locator/abstract_replication_strategy.hh,
  ent/encryption/encryption.cc: used in default member initializers and
  constructor member-init-lists. Objects are always constructed on reactor
  threads.

Not changed:
- scylla-gdb.py: reads smp::count as a GDB symbol (no reactor context).
- Python test files: only reference smp::count in comments/strings.
This commit is contained in:
Avi Kivity
2026-05-20 21:38:23 +03:00
parent 3fe64681e9
commit 8010e408a2
99 changed files with 379 additions and 379 deletions

View File

@@ -350,14 +350,14 @@ future<> db::commitlog_replayer::recover(std::vector<sstring> files, sstring fna
for (auto& d : descs) {
replay_position p = d;
map[p.shard_id() % smp::count].push_back(std::move(d));
map[p.shard_id() % this_smp_shard_count()].push_back(std::move(d));
}
}
co_await _impl->start();
std::exception_ptr e;
try {
auto totals = co_await map_reduce(smp::all_cpus(), [&](unsigned id) -> future<impl::stats> {
auto totals = co_await map_reduce(this_smp_all_shards(), [&](unsigned id) -> future<impl::stats> {
co_return co_await smp::submit_to(id, [&] () -> future<impl::stats> {
impl::stats total;
std::unordered_map<unsigned, commitlog::replay_state> states;