/* This function sets the update marker flag for volume @vol. Returns zero in case of success and a negative error code in case of failure.  */
static int set_update_marker(struct ubi_device *ubi, struct ubi_volume *vol)
/* This function sets the update marker flag for volume @vol. Returns zero in case of success and a negative error code in case of failure.  */
static int set_update_marker(struct ubi_device *ubi, struct ubi_volume *vol)
{
	int err;
	struct ubi_vtbl_record vtbl_rec;
	dbg_gen("set update marker for volume %d", vol->vol_id);
	if (vol->upd_marker) {
		ubi_assert(ubi->vtbl[vol->vol_id].upd_marker);
		dbg_gen("already set");
		return 0;
	}
	vtbl_rec = ubi->vtbl[vol->vol_id];
	vtbl_rec.upd_marker = 1;
	mutex_lock(&ubi->device_mutex);
	err = ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec);
	vol->upd_marker = 1;
	mutex_unlock(&ubi->device_mutex);
	return err;
}