From 3a8d4642861fb69b62401949e490c0bcb19ceb40 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Sun, 16 Dec 2007 12:32:51 +0200 Subject: 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 --- drivers/mtd/ubi/ubi.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'drivers/mtd/ubi/ubi.h') diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 318ce25..0f2ea81 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h @@ -97,6 +97,28 @@ enum { extern int ubi_devices_cnt; extern struct ubi_device *ubi_devices[]; +/** + * struct ubi_ltree_entry - an entry in the lock tree. + * @rb: links RB-tree nodes + * @vol_id: volume ID of the locked logical eraseblock + * @lnum: locked logical eraseblock number + * @users: how many tasks are using this logical eraseblock or wait for it + * @mutex: read/write mutex to implement read/write access serialization to + * the (@vol_id, @lnum) logical eraseblock + * + * This data structure is used in the EBA unit to implement per-LEB locking. + * When a logical eraseblock is being locked - corresponding + * &struct ubi_ltree_entry object is inserted to the lock tree (@ubi->ltree). + * See EBA unit for details. + */ +struct ubi_ltree_entry { + struct rb_node rb; + int vol_id; + int lnum; + int users; + struct rw_semaphore mutex; +}; + struct ubi_volume_desc; /** @@ -359,6 +381,7 @@ struct ubi_device { #endif }; +extern struct kmem_cache *ubi_ltree_slab; extern struct file_operations ubi_cdev_operations; extern struct file_operations ubi_vol_cdev_operations; extern struct class *ubi_class; -- cgit v1.1