/* find_first_dirty - find first dirty znode. @znode: znode to begin searching from  */
static struct ubifs_znode* find_first_dirty(struct ubifs_znode *znode)
/* find_first_dirty - find first dirty znode. @znode: znode to begin searching from  */
static struct ubifs_znode* find_first_dirty(struct ubifs_znode *znode)
{
	int i, cont;
	if (!znode)
		return NULL;
	while (1) {
		if (znode->level == 0) {
			if (ubifs_zn_dirty(znode))
				return znode;
			return NULL;
		}
		cont = 0;
		for (i = 0; i < znode->child_cnt; i++) {
			struct ubifs_zbranch *zbr = &znode->zbranch[i];
			if (zbr->znode && ubifs_zn_dirty(zbr->znode)) {
				znode = zbr->znode;
				cont = 1;
				break;
			}
		}
		if (!cont) {
			if (ubifs_zn_dirty(znode))
				return znode;
			return NULL;
		}
	}
}