mirror of
https://github.com/versity/scoutfs.git
synced 2026-02-07 19:20:44 +00:00
f0a7c4f29448e2cfce9d94c573a37d6112250c45
The item count estimate functions didn't obviously differentiate between adding to a count and resetting it. Most callers initialized the count struct to 0 on the stack, incremented their estimate once, and passed it in. The problem is that those same functions that increment once in callers are also used in other estimates to build counts based on multiple operations. This tripped up the data truncate path. It looped and kept incrementing its count while truncating a file with lots of extents until the count got so large that it didn't fit in a segment by itself and blocked forever. This cleans up the item count code so that it's much harder to get wrong. We differentiate between the SIC_*() high level count estimates that are meant to be passed in to _hold_trans(), and the internal __count_*() functions which are used to add up the item counts that make up an aggregate operation. With this fix the only way to use the count in extent truncation is to correctly reset it for the item count for each transacation. Signed-off-by: Zach Brown <zab@versity.com>
Description
No description provided
Languages
C
87%
Shell
9.3%
Roff
2.5%
TeX
0.8%
Makefile
0.4%