/* This function moves node @snod to @wbuf, changes TNC correspondingly, and destroys @snod. Returns zero in case of success and a negative error code in case of failure.  */
static int move_node(struct ubifs_info *c, struct ubifs_scan_leb *sleb, struct ubifs_scan_node *snod, struct ubifs_wbuf *wbuf)
/* This function moves node @snod to @wbuf, changes TNC correspondingly, and destroys @snod. Returns zero in case of success and a negative error code in case of failure.  */
static int move_node(struct ubifs_info *c, struct ubifs_scan_leb *sleb, struct ubifs_scan_node *snod, struct ubifs_wbuf *wbuf)
{
	int err, new_lnum = wbuf->lnum, new_offs = wbuf->offs + wbuf->used;
	cond_resched();
	err = ubifs_wbuf_write_nolock(wbuf, snod->node, snod->len);
	if (err)
		return err;
	err = ubifs_tnc_replace(c, &snod->key, sleb->lnum,
				snod->offs, new_lnum, new_offs,
				snod->len);
	list_del(&snod->list);
	kfree(snod);
	return err;
}