/* This function does semi-dirty reads of local alloc size and state! This is ok however, as the values are re-checked once under mutex.  */
int ocfs2_alloc_should_use_local(struct ocfs2_super *osb, u64 bits)
/* This function does semi-dirty reads of local alloc size and state! This is ok however, as the values are re-checked once under mutex.  */
int ocfs2_alloc_should_use_local(struct ocfs2_super *osb, u64 bits)
{
	int ret = 0;
	int la_bits;
	spin_lock(&osb->osb_lock);
	la_bits = osb->local_alloc_bits;
	if (!ocfs2_la_state_enabled(osb))
		goto bail;
	if (bits > (la_bits / 2))
		goto bail;
	ret = 1;
bail:
	mlog(0, "state=%d, bits=%llu, la_bits=%d, ret=%d\n",
	     osb->local_alloc_state, (unsigned long long)bits, la_bits, ret);
	spin_unlock(&osb->osb_lock);
	return ret;
}