Skip to content

Commit a52bac9

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent afdafad commit a52bac9

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

reftable/stack.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,25 +1328,17 @@ static int stack_compact_range(struct reftable_stack *st,
13281328
strbuf_release(&table_name);
13291329
free_names(names);
13301330

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);
13401331
if (err == REFTABLE_LOCK_ERROR)
13411332
st->stats.failures++;
1333+
13421334
return err;
13431335
}
13441336

13451337
int reftable_stack_compact_all(struct reftable_stack *st,
13461338
struct reftable_log_expiry_config *config)
13471339
{
13481340
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);
13501342
}
13511343

13521344
static int segment_size(struct segment *s)
@@ -1452,8 +1444,8 @@ int reftable_stack_auto_compact(struct reftable_stack *st)
14521444
st->opts.auto_compaction_factor);
14531445
reftable_free(sizes);
14541446
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);
14571449

14581450
return 0;
14591451
}

0 commit comments

Comments
 (0)