/* This function is called by garbage collection to determine if commit should be run. If commit state is @COMMIT_BACKGROUND, which means that the journal is full enough to start commit, this function returns true. It is not absolutely necessary to commit yet, but it feels like this should be better then to keep doing GC. This function returns %1 if GC has to initiate commit and %0 if not.  */
int ubifs_gc_should_commit(struct ubifs_info *c)
/* This function is called by garbage collection to determine if commit should be run. If commit state is @COMMIT_BACKGROUND, which means that the journal is full enough to start commit, this function returns true. It is not absolutely necessary to commit yet, but it feels like this should be better then to keep doing GC. This function returns %1 if GC has to initiate commit and %0 if not.  */
int ubifs_gc_should_commit(struct ubifs_info *c)
{
	int ret = 0;
	spin_lock(&c->cs_lock);
	if (c->cmt_state == COMMIT_BACKGROUND) {
		dbg_cmt("commit required now");
		c->cmt_state = COMMIT_REQUIRED;
	} else
		dbg_cmt("commit not requested");
	if (c->cmt_state == COMMIT_REQUIRED)
		ret = 1;
	spin_unlock(&c->cs_lock);
	return ret;
}