aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/vtbl.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-17 08:42:57 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-26 12:15:16 -0500
commitd05c77a816974c09f8c7e8f48e5b9f7b59dafdf3 (patch)
tree6263ef3ad76c654e9d2635e5145f15c2b517edeb /drivers/mtd/ubi/vtbl.c
parentdb6e5770ef0ab351a403ac26e1ab1309e58f15d7 (diff)
UBI: introduce volume refcounting
Add ref_count field to UBI volumes and remove weired "vol->removed" field. This way things are better understandable and we do not have to do whold show_attr operation under spinlock. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/vtbl.c')
-rw-r--r--drivers/mtd/ubi/vtbl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index 5879fdb3e6d5..a37dc7a213b1 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -565,6 +565,7 @@ static int init_volumes(struct ubi_device *ubi, const struct ubi_scan_info *si,
565 vol->last_eb_bytes = sv->last_data_size; 565 vol->last_eb_bytes = sv->last_data_size;
566 } 566 }
567 567
568 /* And add the layout volume */
568 vol = kzalloc(sizeof(struct ubi_volume), GFP_KERNEL); 569 vol = kzalloc(sizeof(struct ubi_volume), GFP_KERNEL);
569 if (!vol) 570 if (!vol)
570 return -ENOMEM; 571 return -ENOMEM;
@@ -580,6 +581,7 @@ static int init_volumes(struct ubi_device *ubi, const struct ubi_scan_info *si,
580 vol->used_bytes = 581 vol->used_bytes =
581 (long long)vol->used_ebs * (ubi->leb_size - vol->data_pad); 582 (long long)vol->used_ebs * (ubi->leb_size - vol->data_pad);
582 vol->vol_id = UBI_LAYOUT_VOL_ID; 583 vol->vol_id = UBI_LAYOUT_VOL_ID;
584 vol->ref_count = 1;
583 585
584 ubi_assert(!ubi->volumes[i]); 586 ubi_assert(!ubi->volumes[i]);
585 ubi->volumes[vol_id2idx(ubi, vol->vol_id)] = vol; 587 ubi->volumes[vol_id2idx(ubi, vol->vol_id)] = vol;