Commit 383d08e0 authored by Artem Bityutskiy's avatar Artem Bityutskiy

UBI: remove redundant mutex

The @mult_mutex does not serve any purpose. We already have
@volumes_mutex and it is enough. The @volume mutex is pushed
down to the 'ubi_rename_volumes()', because we want first
to open all volumes in the exclusive mode, and then lock the
mutex, just like all other ioctl's (remove, re-size, etc) do.
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent 1406de8e
...@@ -806,7 +806,6 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset) ...@@ -806,7 +806,6 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset)
mutex_init(&ubi->buf_mutex); mutex_init(&ubi->buf_mutex);
mutex_init(&ubi->ckvol_mutex); mutex_init(&ubi->ckvol_mutex);
mutex_init(&ubi->mult_mutex);
mutex_init(&ubi->volumes_mutex); mutex_init(&ubi->volumes_mutex);
spin_lock_init(&ubi->volumes_lock); spin_lock_init(&ubi->volumes_lock);
......
...@@ -810,9 +810,7 @@ static int rename_volumes(struct ubi_device *ubi, ...@@ -810,9 +810,7 @@ static int rename_volumes(struct ubi_device *ubi,
re->desc->vol->vol_id, re->desc->vol->name); re->desc->vol->vol_id, re->desc->vol->name);
} }
mutex_lock(&ubi->volumes_mutex);
err = ubi_rename_volumes(ubi, &rename_list); err = ubi_rename_volumes(ubi, &rename_list);
mutex_unlock(&ubi->volumes_mutex);
out_free: out_free:
list_for_each_entry_safe(re, re1, &rename_list, list) { list_for_each_entry_safe(re, re1, &rename_list, list) {
...@@ -952,9 +950,9 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd, ...@@ -952,9 +950,9 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd,
break; break;
} }
mutex_lock(&ubi->mult_mutex); mutex_lock(&ubi->volumes_mutex);
err = rename_volumes(ubi, req); err = rename_volumes(ubi, req);
mutex_unlock(&ubi->mult_mutex); mutex_unlock(&ubi->volumes_mutex);
kfree(req); kfree(req);
break; break;
} }
......
...@@ -366,7 +366,6 @@ struct ubi_wl_entry; ...@@ -366,7 +366,6 @@ struct ubi_wl_entry;
* @peb_buf2: another buffer of PEB size used for different purposes * @peb_buf2: another buffer of PEB size used for different purposes
* @buf_mutex: protects @peb_buf1 and @peb_buf2 * @buf_mutex: protects @peb_buf1 and @peb_buf2
* @ckvol_mutex: serializes static volume checking when opening * @ckvol_mutex: serializes static volume checking when opening
* @mult_mutex: serializes operations on multiple volumes, like re-naming
* @dbg_peb_buf: buffer of PEB size used for debugging * @dbg_peb_buf: buffer of PEB size used for debugging
* @dbg_buf_mutex: protects @dbg_peb_buf * @dbg_buf_mutex: protects @dbg_peb_buf
*/ */
...@@ -444,7 +443,6 @@ struct ubi_device { ...@@ -444,7 +443,6 @@ struct ubi_device {
void *peb_buf2; void *peb_buf2;
struct mutex buf_mutex; struct mutex buf_mutex;
struct mutex ckvol_mutex; struct mutex ckvol_mutex;
struct mutex mult_mutex;
#ifdef CONFIG_MTD_UBI_DEBUG #ifdef CONFIG_MTD_UBI_DEBUG
void *dbg_peb_buf; void *dbg_peb_buf;
struct mutex dbg_buf_mutex; struct mutex dbg_buf_mutex;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment