diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2007-12-16 05:32:51 -0500 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2007-12-26 12:15:14 -0500 |
commit | 3a8d4642861fb69b62401949e490c0bcb19ceb40 (patch) | |
tree | cb1d196fc42fa590f755abd336e4be777e60ff62 /drivers/mtd/ubi/ubi.h | |
parent | 01f7b309e453dc8499c318f6810f76b606b66134 (diff) |
UBI: create ltree_entry slab on initialization
Since the ltree_entry slab cache is a global entity, which is
used by all UBI devices, it is more logical to create it on
module initialization time and destro on module exit time.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/ubi.h')
-rw-r--r-- | drivers/mtd/ubi/ubi.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 318ce2543fb8..0f2ea81b3122 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h | |||
@@ -97,6 +97,28 @@ enum { | |||
97 | extern int ubi_devices_cnt; | 97 | extern int ubi_devices_cnt; |
98 | extern struct ubi_device *ubi_devices[]; | 98 | extern struct ubi_device *ubi_devices[]; |
99 | 99 | ||
100 | /** | ||
101 | * struct ubi_ltree_entry - an entry in the lock tree. | ||
102 | * @rb: links RB-tree nodes | ||
103 | * @vol_id: volume ID of the locked logical eraseblock | ||
104 | * @lnum: locked logical eraseblock number | ||
105 | * @users: how many tasks are using this logical eraseblock or wait for it | ||
106 | * @mutex: read/write mutex to implement read/write access serialization to | ||
107 | * the (@vol_id, @lnum) logical eraseblock | ||
108 | * | ||
109 | * This data structure is used in the EBA unit to implement per-LEB locking. | ||
110 | * When a logical eraseblock is being locked - corresponding | ||
111 | * &struct ubi_ltree_entry object is inserted to the lock tree (@ubi->ltree). | ||
112 | * See EBA unit for details. | ||
113 | */ | ||
114 | struct ubi_ltree_entry { | ||
115 | struct rb_node rb; | ||
116 | int vol_id; | ||
117 | int lnum; | ||
118 | int users; | ||
119 | struct rw_semaphore mutex; | ||
120 | }; | ||
121 | |||
100 | struct ubi_volume_desc; | 122 | struct ubi_volume_desc; |
101 | 123 | ||
102 | /** | 124 | /** |
@@ -359,6 +381,7 @@ struct ubi_device { | |||
359 | #endif | 381 | #endif |
360 | }; | 382 | }; |
361 | 383 | ||
384 | extern struct kmem_cache *ubi_ltree_slab; | ||
362 | extern struct file_operations ubi_cdev_operations; | 385 | extern struct file_operations ubi_cdev_operations; |
363 | extern struct file_operations ubi_vol_cdev_operations; | 386 | extern struct file_operations ubi_vol_cdev_operations; |
364 | extern struct class *ubi_class; | 387 | extern struct class *ubi_class; |