reftable/stack: inline `stack_compact_range_stats()`

The only difference between `stack_compact_range_stats()` and `stack_compact_range()` is that the former updates stats on failure, whereas the latter doesn't. There are no callers anymore that do not want their stats updated though, making the indirection unnecessary. Inline the stat updates into `stack_compact_range()`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Aug 23, 2024 at 16:12 UTC a52bac9ac0c6eac60244e902e4b65e9ddab066aa
1 file changed +4 -12
reftable/stack.c
+4 -12
@@ -1328,17 +1328,9 @@ done:
1328 strbuf_release(&table_name);
1329 free_names(names);
1330
1331 - return err;
1332 -}
1333 -
1334 -static int stack_compact_range_stats(struct reftable_stack *st,
1335 - size_t first, size_t last,
1336 - struct reftable_log_expiry_config *config,
1337 - unsigned int flags)
1338 -{
1339 - int err = stack_compact_range(st, first, last, config, flags);
1331 if (err == REFTABLE_LOCK_ERROR)
1332 st->stats.failures++;
1333 +
1334 return err;
1335 }
1336
@@ -1346,7 +1338,7 @@ int reftable_stack_compact_all(struct reftable_stack *st,
1338 struct reftable_log_expiry_config *config)
1339 {
1340 size_t last = st->merged->readers_len ? st->merged->readers_len - 1 : 0;
1349 - return stack_compact_range_stats(st, 0, last, config, 0);
1341 + return stack_compact_range(st, 0, last, config, 0);
1342 }
1343
1344 static int segment_size(struct segment *s)
@@ -1452,8 +1444,8 @@ int reftable_stack_auto_compact(struct reftable_stack *st)
1444 st->opts.auto_compaction_factor);
1445 reftable_free(sizes);
1446 if (segment_size(&seg) > 0)
1455 - return stack_compact_range_stats(st, seg.start, seg.end - 1,
1456 - NULL, STACK_COMPACT_RANGE_BEST_EFFORT);
1447 + return stack_compact_range(st, seg.start, seg.end - 1,
1448 + NULL, STACK_COMPACT_RANGE_BEST_EFFORT);
1449
1450 return 0;
1451 }