diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2010-10-16 16:34:39 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2010-10-30 06:12:50 -0400 |
commit | 51dfacdef38b1dd6fc58b03dd1725d517516b115 (patch) | |
tree | 71db75044a42f316c5956bb807f9846c14d12b16 /fs | |
parent | 117bf5fbdbdc7a5394e5718b3354238961c83067 (diff) |
jbd2: Convert jbd2_slab_create_sem to mutex
jbd2_slab_create_sem is used as a mutex, so make it one.
[ akpm muttered: We may as well make it local to
jbd2_journal_create_slab() also. ]
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ted Ts'o <tytso@mit.edu>
Cc: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <alpine.LFD.2.00.1010162231480.2496@localhost6.localdomain6>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/jbd2/journal.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 538417c1fdbb..c590d155c095 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -1838,7 +1838,6 @@ size_t journal_tag_bytes(journal_t *journal) | |||
1838 | */ | 1838 | */ |
1839 | #define JBD2_MAX_SLABS 8 | 1839 | #define JBD2_MAX_SLABS 8 |
1840 | static struct kmem_cache *jbd2_slab[JBD2_MAX_SLABS]; | 1840 | static struct kmem_cache *jbd2_slab[JBD2_MAX_SLABS]; |
1841 | static DECLARE_MUTEX(jbd2_slab_create_sem); | ||
1842 | 1841 | ||
1843 | static const char *jbd2_slab_names[JBD2_MAX_SLABS] = { | 1842 | static const char *jbd2_slab_names[JBD2_MAX_SLABS] = { |
1844 | "jbd2_1k", "jbd2_2k", "jbd2_4k", "jbd2_8k", | 1843 | "jbd2_1k", "jbd2_2k", "jbd2_4k", "jbd2_8k", |
@@ -1859,6 +1858,7 @@ static void jbd2_journal_destroy_slabs(void) | |||
1859 | 1858 | ||
1860 | static int jbd2_journal_create_slab(size_t size) | 1859 | static int jbd2_journal_create_slab(size_t size) |
1861 | { | 1860 | { |
1861 | static DEFINE_MUTEX(jbd2_slab_create_mutex); | ||
1862 | int i = order_base_2(size) - 10; | 1862 | int i = order_base_2(size) - 10; |
1863 | size_t slab_size; | 1863 | size_t slab_size; |
1864 | 1864 | ||
@@ -1870,16 +1870,16 @@ static int jbd2_journal_create_slab(size_t size) | |||
1870 | 1870 | ||
1871 | if (unlikely(i < 0)) | 1871 | if (unlikely(i < 0)) |
1872 | i = 0; | 1872 | i = 0; |
1873 | down(&jbd2_slab_create_sem); | 1873 | mutex_lock(&jbd2_slab_create_mutex); |
1874 | if (jbd2_slab[i]) { | 1874 | if (jbd2_slab[i]) { |
1875 | up(&jbd2_slab_create_sem); | 1875 | mutex_unlock(&jbd2_slab_create_mutex); |
1876 | return 0; /* Already created */ | 1876 | return 0; /* Already created */ |
1877 | } | 1877 | } |
1878 | 1878 | ||
1879 | slab_size = 1 << (i+10); | 1879 | slab_size = 1 << (i+10); |
1880 | jbd2_slab[i] = kmem_cache_create(jbd2_slab_names[i], slab_size, | 1880 | jbd2_slab[i] = kmem_cache_create(jbd2_slab_names[i], slab_size, |
1881 | slab_size, 0, NULL); | 1881 | slab_size, 0, NULL); |
1882 | up(&jbd2_slab_create_sem); | 1882 | mutex_unlock(&jbd2_slab_create_mutex); |
1883 | if (!jbd2_slab[i]) { | 1883 | if (!jbd2_slab[i]) { |
1884 | printk(KERN_EMERG "JBD2: no memory for jbd2_slab cache\n"); | 1884 | printk(KERN_EMERG "JBD2: no memory for jbd2_slab cache\n"); |
1885 | return -ENOMEM; | 1885 | return -ENOMEM; |