Commit 362376a7 authored by Gu Zheng's avatar Gu Zheng Committed by Brian Norris

mtd: mtdblock: remove the needless mtdblks_lock

The global lock mtdblks_lock was used to protect the original mtdblks
array to avoid race conditions. As the mtdblks array was already gone,
but the mtdblks_lock is left, and it causes latency when open/release dev.
So we need to remove it here.
Signed-off-by: default avatarGu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent 0b56d2d4
...@@ -45,8 +45,6 @@ struct mtdblk_dev { ...@@ -45,8 +45,6 @@ struct mtdblk_dev {
enum { STATE_EMPTY, STATE_CLEAN, STATE_DIRTY } cache_state; enum { STATE_EMPTY, STATE_CLEAN, STATE_DIRTY } cache_state;
}; };
static DEFINE_MUTEX(mtdblks_lock);
/* /*
* Cache stuff... * Cache stuff...
* *
...@@ -286,10 +284,8 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd) ...@@ -286,10 +284,8 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd)
pr_debug("mtdblock_open\n"); pr_debug("mtdblock_open\n");
mutex_lock(&mtdblks_lock);
if (mtdblk->count) { if (mtdblk->count) {
mtdblk->count++; mtdblk->count++;
mutex_unlock(&mtdblks_lock);
return 0; return 0;
} }
...@@ -302,8 +298,6 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd) ...@@ -302,8 +298,6 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd)
mtdblk->cache_data = NULL; mtdblk->cache_data = NULL;
} }
mutex_unlock(&mtdblks_lock);
pr_debug("ok\n"); pr_debug("ok\n");
return 0; return 0;
...@@ -315,8 +309,6 @@ static void mtdblock_release(struct mtd_blktrans_dev *mbd) ...@@ -315,8 +309,6 @@ static void mtdblock_release(struct mtd_blktrans_dev *mbd)
pr_debug("mtdblock_release\n"); pr_debug("mtdblock_release\n");
mutex_lock(&mtdblks_lock);
mutex_lock(&mtdblk->cache_mutex); mutex_lock(&mtdblk->cache_mutex);
write_cached_data(mtdblk); write_cached_data(mtdblk);
mutex_unlock(&mtdblk->cache_mutex); mutex_unlock(&mtdblk->cache_mutex);
...@@ -331,8 +323,6 @@ static void mtdblock_release(struct mtd_blktrans_dev *mbd) ...@@ -331,8 +323,6 @@ static void mtdblock_release(struct mtd_blktrans_dev *mbd)
vfree(mtdblk->cache_data); vfree(mtdblk->cache_data);
} }
mutex_unlock(&mtdblks_lock);
pr_debug("ok\n"); pr_debug("ok\n");
} }
......
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