static int l1_table_update(struct qcow_state *s, unsigned int l1_index, uint64_t l2_offset)
{
	ssize_t ret;

	tcmu_dbg("%s: setting L1[%d] to %llx\n", __func__, l1_index, l2_offset);
	s->l1_table[l1_index] = htobe64(l2_offset);

	ret = pwrite(s->fd,
		&s->l1_table[l1_index],
		sizeof(uint64_t),
		s->l1_table_offset + (l1_index * sizeof(uint64_t)));

	if (ret != sizeof(uint64_t))
		tcmu_err("%s: error, L1 writeback failed (%zd)\n", __func__, ret);

	fdatasync(s->fd);
	return ret;
}
static int l1_table_update(struct qcow_state *s, unsigned int l1_index, uint64_t l2_offset)
{
	ssize_t ret;

	tcmu_dbg("%s: setting L1[%d] to %llx\n", __func__, l1_index, l2_offset);
	s->l1_table[l1_index] = htobe64(l2_offset);

	ret = pwrite(s->fd,
		&s->l1_table[l1_index],
		sizeof(uint64_t),
		s->l1_table_offset + (l1_index * sizeof(uint64_t)));

	if (ret != sizeof(uint64_t))
		tcmu_err("%s: error, L1 writeback failed (%zd)\n", __func__, ret);

	fdatasync(s->fd);
	return ret;
}