]> git.ipfire.org Git - thirdparty/git.git/commitdiff
reftable/stack: inline `stack_compact_range_stats()`
authorPatrick Steinhardt <ps@pks.im>
Fri, 23 Aug 2024 14:12:32 +0000 (16:12 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 23 Aug 2024 15:04:46 +0000 (08:04 -0700)
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>
reftable/stack.c

index d3a95d2f1d75c9493adf921c8b2fa33d3381e22f..891ea971b722426362e19bcbb9f81e74d29eb569 100644 (file)
@@ -1328,17 +1328,9 @@ done:
        strbuf_release(&table_name);
        free_names(names);
 
-       return err;
-}
-
-static int stack_compact_range_stats(struct reftable_stack *st,
-                                    size_t first, size_t last,
-                                    struct reftable_log_expiry_config *config,
-                                    unsigned int flags)
-{
-       int err = stack_compact_range(st, first, last, config, flags);
        if (err == REFTABLE_LOCK_ERROR)
                st->stats.failures++;
+
        return err;
 }
 
@@ -1346,7 +1338,7 @@ int reftable_stack_compact_all(struct reftable_stack *st,
                               struct reftable_log_expiry_config *config)
 {
        size_t last = st->merged->readers_len ? st->merged->readers_len - 1 : 0;
-       return stack_compact_range_stats(st, 0, last, config, 0);
+       return stack_compact_range(st, 0, last, config, 0);
 }
 
 static int segment_size(struct segment *s)
@@ -1452,8 +1444,8 @@ int reftable_stack_auto_compact(struct reftable_stack *st)
                                           st->opts.auto_compaction_factor);
        reftable_free(sizes);
        if (segment_size(&seg) > 0)
-               return stack_compact_range_stats(st, seg.start, seg.end - 1,
-                                                NULL, STACK_COMPACT_RANGE_BEST_EFFORT);
+               return stack_compact_range(st, seg.start, seg.end - 1,
+                                          NULL, STACK_COMPACT_RANGE_BEST_EFFORT);
 
        return 0;
 }