aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-26 08:59:39 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-26 12:15:18 -0500
commit4b3cc340614e552c476bec29d984c5a363b26494 (patch)
tree5fd0df68217f18dcfb80761c932a5dcba5de947d
parentaeddb87718823fb81b896155b34d1bb4c8cae874 (diff)
UBI: bugfix: do not forget to increment vol_count
When creating a new volume, do not forget to increment the vol_count variable. Also, users are not interested in internal volumes, so do not show them in the volumes_count sysfs file. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r--drivers/mtd/ubi/build.c2
-rw-r--r--drivers/mtd/ubi/vmt.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index b967191cc97e..8f1f9feb2d60 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -246,7 +246,7 @@ static ssize_t dev_attribute_show(struct device *dev,
246 else if (attr == &dev_total_eraseblocks) 246 else if (attr == &dev_total_eraseblocks)
247 ret = sprintf(buf, "%d\n", ubi->good_peb_count); 247 ret = sprintf(buf, "%d\n", ubi->good_peb_count);
248 else if (attr == &dev_volumes_count) 248 else if (attr == &dev_volumes_count)
249 ret = sprintf(buf, "%d\n", ubi->vol_count); 249 ret = sprintf(buf, "%d\n", ubi->vol_count - UBI_INT_VOL_COUNT);
250 else if (attr == &dev_max_ec) 250 else if (attr == &dev_max_ec)
251 ret = sprintf(buf, "%d\n", ubi->max_ec); 251 ret = sprintf(buf, "%d\n", ubi->max_ec);
252 else if (attr == &dev_reserved_for_bad) 252 else if (attr == &dev_reserved_for_bad)
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index 42d3dd70f2d0..177227e1f80d 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -357,6 +357,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
357 357
358 spin_lock(&ubi->volumes_lock); 358 spin_lock(&ubi->volumes_lock);
359 ubi->volumes[vol_id] = vol; 359 ubi->volumes[vol_id] = vol;
360 ubi->vol_count += 1;
360 spin_unlock(&ubi->volumes_lock); 361 spin_unlock(&ubi->volumes_lock);
361 362
362 paranoid_check_volumes(ubi); 363 paranoid_check_volumes(ubi);