/* This is a helper function for 'tnc_insert()'. When the key of the leftmost zbranch changes, keys of parent znodes have to be corrected. This helper function is called in such situations and corrects the keys if needed.  */
static void correct_parent_keys(const struct ubifs_info *c, struct ubifs_znode *znode)
/* This is a helper function for 'tnc_insert()'. When the key of the leftmost zbranch changes, keys of parent znodes have to be corrected. This helper function is called in such situations and corrects the keys if needed.  */
static void correct_parent_keys(const struct ubifs_info *c, struct ubifs_znode *znode)
{
	union ubifs_key *key, *key1;
	ubifs_assert(znode->parent);
	ubifs_assert(znode->iip == 0);
	key = &znode->zbranch[0].key;
	key1 = &znode->parent->zbranch[0].key;
	while (keys_cmp(c, key, key1) < 0) {
		key_copy(c, key, key1);
		znode = znode->parent;
		znode->alt = 1;
		if (!znode->parent || znode->iip)
			break;
		key1 = &znode->parent->zbranch[0].key;
	}
}