UBI: tweak volumes locking

Transform vtbl_mutex to volumes_mutex - this just makes code
easier to understand.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
This commit is contained in:
Artem Bityutskiy
2007-12-17 12:46:48 +02:00
parent 89b96b6929
commit cae0a77125
6 changed files with 34 additions and 23 deletions

View File

@@ -162,15 +162,16 @@ struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode)
desc->mode = mode;
/*
* To prevent simultaneous checks of the same volume we use @vtbl_mutex,
* although it is not the purpose it was introduced for.
* To prevent simultaneous checks of the same volume we use
* @volumes_mutex, although it is not the purpose it was introduced
* for.
*/
mutex_lock(&ubi->vtbl_mutex);
mutex_lock(&ubi->volumes_mutex);
if (!vol->checked) {
/* This is the first open - check the volume */
err = ubi_check_volume(ubi, vol_id);
if (err < 0) {
mutex_unlock(&ubi->vtbl_mutex);
mutex_unlock(&ubi->volumes_mutex);
ubi_close_volume(desc);
return ERR_PTR(err);
}
@@ -181,7 +182,7 @@ struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode)
}
vol->checked = 1;
}
mutex_unlock(&ubi->vtbl_mutex);
mutex_unlock(&ubi->volumes_mutex);
return desc;
out_unlock: