UBI: Fastmap: Locking updates
a) Rename ubi->fm_sem to ubi->fm_eba_sem as this semaphore protects EBA changes. b) Turn ubi->fm_mutex into a rw semaphore. It will still serialize fastmap writes but also ensures that ubi_wl_put_peb() is not interrupted by a fastmap write. We use a rw semaphore to allow ubi_wl_put_peb() still to be executed in parallel if no fastmap write is happening. Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
@@ -426,10 +426,11 @@ struct ubi_debug_info {
|
||||
* @fm_pool: in-memory data structure of the fastmap pool
|
||||
* @fm_wl_pool: in-memory data structure of the fastmap pool used by the WL
|
||||
* sub-system
|
||||
* @fm_mutex: serializes ubi_update_fastmap() and protects @fm_buf
|
||||
* @fm_protect: serializes ubi_update_fastmap(), protects @fm_buf and makes sure
|
||||
* that critical sections cannot be interrupted by ubi_update_fastmap()
|
||||
* @fm_buf: vmalloc()'d buffer which holds the raw fastmap
|
||||
* @fm_size: fastmap size in bytes
|
||||
* @fm_sem: allows ubi_update_fastmap() to block EBA table changes
|
||||
* @fm_eba_sem: allows ubi_update_fastmap() to block EBA table changes
|
||||
* @fm_work: fastmap work queue
|
||||
* @fm_work_scheduled: non-zero if fastmap work was scheduled
|
||||
*
|
||||
@@ -534,8 +535,8 @@ struct ubi_device {
|
||||
struct ubi_fastmap_layout *fm;
|
||||
struct ubi_fm_pool fm_pool;
|
||||
struct ubi_fm_pool fm_wl_pool;
|
||||
struct rw_semaphore fm_sem;
|
||||
struct mutex fm_mutex;
|
||||
struct rw_semaphore fm_eba_sem;
|
||||
struct rw_semaphore fm_protect;
|
||||
void *fm_buf;
|
||||
size_t fm_size;
|
||||
struct work_struct fm_work;
|
||||
|
Reference in New Issue
Block a user