aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/ubi.h
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-09-13 07:28:14 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-10-14 06:10:21 -0400
commite8823bd63d50bb1f9bd73f1197230e1f7217456a (patch)
tree3b8b849512686aebda99f83d290c9e09ed983967 /drivers/mtd/ubi/ubi.h
parent6986646ba752fef150286926aa922ef04e9d19dd (diff)
UBI: fix atomic LEB change problems
When the UBI device is nearly full, i.e. all LEBs are mapped, we have only one spare LEB left - the one we reserved for WL purposes. Well, I do not count the LEBs which were reserved for bad PEB handling - suppose NOR flash for simplicity. If an "atomic LEB change operation" is run, and the WL unit is moving a LEB, we have no spare LEBs to finish the operation and fail, which is not good. Moreover, if there are 2 or more simultanious "atomic LEB change" requests, only one of them has chances to succeed, the other will fail with -ENOSPC. Not good either. This patch does 2 things: 1. Reserves one PEB for the "atomic LEB change" operation. 2. Serealize the operations so that only on of them may run at a time (by means of a mutex). Pointed-to-by: Brijesh Singh <brijesh.s.singh@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/ubi.h')
-rw-r--r--drivers/mtd/ubi/ubi.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index cc010111264..5e941a63303 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -221,14 +221,15 @@ struct ubi_wl_entry;
221 * @vtbl_slots: how many slots are available in the volume table 221 * @vtbl_slots: how many slots are available in the volume table
222 * @vtbl_size: size of the volume table in bytes 222 * @vtbl_size: size of the volume table in bytes
223 * @vtbl: in-RAM volume table copy 223 * @vtbl: in-RAM volume table copy
224 * @vtbl_mutex: protects on-flash volume table
224 * 225 *
225 * @max_ec: current highest erase counter value 226 * @max_ec: current highest erase counter value
226 * @mean_ec: current mean erase counter value 227 * @mean_ec: current mean erase counter value
227 * 228 *
228 * global_sqnum: global sequence number 229 * @global_sqnum: global sequence number
229 * @ltree_lock: protects the lock tree and @global_sqnum 230 * @ltree_lock: protects the lock tree and @global_sqnum
230 * @ltree: the lock tree 231 * @ltree: the lock tree
231 * @vtbl_mutex: protects on-flash volume table 232 * @alc_mutex: serializes "atomic LEB change" operations
232 * 233 *
233 * @used: RB-tree of used physical eraseblocks 234 * @used: RB-tree of used physical eraseblocks
234 * @free: RB-tree of free physical eraseblocks 235 * @free: RB-tree of free physical eraseblocks
@@ -308,6 +309,7 @@ struct ubi_device {
308 unsigned long long global_sqnum; 309 unsigned long long global_sqnum;
309 spinlock_t ltree_lock; 310 spinlock_t ltree_lock;
310 struct rb_root ltree; 311 struct rb_root ltree;
312 struct mutex alc_mutex;
311 313
312 /* Wear-leveling unit's stuff */ 314 /* Wear-leveling unit's stuff */
313 struct rb_root used; 315 struct rb_root used;