Skip to content

Commit

Permalink
mtd: mtdblock: remove the needless mtdblks_lock
Browse files Browse the repository at this point in the history
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: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
  • Loading branch information
Gu Zheng authored and Brian Norris committed Jan 7, 2015
1 parent 0b56d2d commit 362376a
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions drivers/mtd/mtdblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ struct mtdblk_dev {
enum { STATE_EMPTY, STATE_CLEAN, STATE_DIRTY } cache_state;
};

static DEFINE_MUTEX(mtdblks_lock);

/*
* Cache stuff...
*
Expand Down Expand Up @@ -286,10 +284,8 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd)

pr_debug("mtdblock_open\n");

mutex_lock(&mtdblks_lock);
if (mtdblk->count) {
mtdblk->count++;
mutex_unlock(&mtdblks_lock);
return 0;
}

Expand All @@ -302,8 +298,6 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd)
mtdblk->cache_data = NULL;
}

mutex_unlock(&mtdblks_lock);

pr_debug("ok\n");

return 0;
Expand All @@ -315,8 +309,6 @@ static void mtdblock_release(struct mtd_blktrans_dev *mbd)

pr_debug("mtdblock_release\n");

mutex_lock(&mtdblks_lock);

mutex_lock(&mtdblk->cache_mutex);
write_cached_data(mtdblk);
mutex_unlock(&mtdblk->cache_mutex);
Expand All @@ -331,8 +323,6 @@ static void mtdblock_release(struct mtd_blktrans_dev *mbd)
vfree(mtdblk->cache_data);
}

mutex_unlock(&mtdblks_lock);

pr_debug("ok\n");
}

Expand Down

0 comments on commit 362376a

Please sign in to comment.