/* Returns %0 on success, and a negative error code on failure.  */
static int ins_clr_old_idx_znode(struct ubifs_info *c, struct ubifs_znode *znode)
/* Returns %0 on success, and a negative error code on failure.  */
static int ins_clr_old_idx_znode(struct ubifs_info *c, struct ubifs_znode *znode)
{
	int err;
	if (znode->parent) {
		struct ubifs_zbranch *zbr;
		zbr = &znode->parent->zbranch[znode->iip];
		if (zbr->len) {
			err = insert_old_idx(c, zbr->lnum, zbr->offs);
			if (err)
				return err;
			zbr->lnum = 0;
			zbr->offs = 0;
			zbr->len = 0;
		}
	} else
		if (c->zroot.len) {
			err = insert_old_idx(c, c->zroot.lnum, c->zroot.offs);
			if (err)
				return err;
			c->zroot.lnum = 0;
			c->zroot.offs = 0;
			c->zroot.len = 0;
		}
	return 0;
}