UBI: add UBI devices reference counting

This is one more step on the way to "removable" UBI devices. It
adds reference counting for UBI devices. Every time a volume on
this device is opened - the device's refcount is increased. It
is also increased if someone is reading any sysfs file of this
UBI device or of one of its volumes.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
This commit is contained in:
Artem Bityutskiy
2007-12-17 17:37:26 +02:00
parent 9f961b5756
commit e73f4459d9
7 changed files with 201 additions and 63 deletions

View File

@@ -1303,6 +1303,7 @@ int ubi_wl_flush(struct ubi_device *ubi)
* Make sure all the works which have been done in parallel are
* finished.
*/
ubi_assert(ubi->ref_count > 0);
down_write(&ubi->work_sem);
up_write(&ubi->work_sem);