/* Note, the calculation is pessimistic, which means that most of the time UBIFS reports less space than it actually has.  */
long long ubifs_reported_space(const struct ubifs_info *c, long long free)
/* Note, the calculation is pessimistic, which means that most of the time UBIFS reports less space than it actually has.  */
long long ubifs_reported_space(const struct ubifs_info *c, long long free)
{
	int divisor, factor, f;
	f = c->fanout > 3 ? c->fanout >> 1 : 2;
	factor = UBIFS_BLOCK_SIZE;
	divisor = UBIFS_MAX_DATA_NODE_SZ;
	divisor += (c->max_idx_node_sz * 3) / (f - 1);
	free *= factor;
	return div_u64(free, divisor);
}