/* This function writes a node to reserved space of journal head @jhead. Returns zero in case of success and a negative error code in case of failure.  */
static int write_node(struct ubifs_info *c, int jhead, void *node, int len, int *lnum, int *offs)
/* This function writes a node to reserved space of journal head @jhead. Returns zero in case of success and a negative error code in case of failure.  */
static int write_node(struct ubifs_info *c, int jhead, void *node, int len, int *lnum, int *offs)
{
	struct ubifs_wbuf *wbuf = &c->jheads[jhead].wbuf;
	ubifs_assert(jhead != GCHD);
	*lnum = c->jheads[jhead].wbuf.lnum;
	*offs = c->jheads[jhead].wbuf.offs + c->jheads[jhead].wbuf.used;
	dbg_jnl("jhead %s, LEB %d:%d, len %d",
		dbg_jhead(jhead), *lnum, *offs, len);
	ubifs_prepare_node(c, node, len, 0);
	return ubifs_wbuf_write_nolock(wbuf, node, len);
}