diff options
author | Matthias Kaehlcke <matthias@kaehlcke.net> | 2008-07-25 22:44:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-26 15:00:03 -0400 |
commit | 7d135a5d50a08bbc53b189d79d8bdb03136f5303 (patch) | |
tree | 5ddc33ffcfefec2ebb2b9e29ca970e2e5ef700b6 /fs/affs/bitmap.c | |
parent | 1956a96de488feb05e95c08c9d5e80f63a4be2b1 (diff) |
affs: convert s_bmlock into a mutex
The semaphore s_bmlock is used as a mutex. Convert it to the mutex API.
Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/affs/bitmap.c')
-rw-r--r-- | fs/affs/bitmap.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/affs/bitmap.c b/fs/affs/bitmap.c index c4a5ad09ddf2..dc5ef14bdc1c 100644 --- a/fs/affs/bitmap.c +++ b/fs/affs/bitmap.c | |||
@@ -45,14 +45,14 @@ affs_count_free_blocks(struct super_block *sb) | |||
45 | if (sb->s_flags & MS_RDONLY) | 45 | if (sb->s_flags & MS_RDONLY) |
46 | return 0; | 46 | return 0; |
47 | 47 | ||
48 | down(&AFFS_SB(sb)->s_bmlock); | 48 | mutex_lock(&AFFS_SB(sb)->s_bmlock); |
49 | 49 | ||
50 | bm = AFFS_SB(sb)->s_bitmap; | 50 | bm = AFFS_SB(sb)->s_bitmap; |
51 | free = 0; | 51 | free = 0; |
52 | for (i = AFFS_SB(sb)->s_bmap_count; i > 0; bm++, i--) | 52 | for (i = AFFS_SB(sb)->s_bmap_count; i > 0; bm++, i--) |
53 | free += bm->bm_free; | 53 | free += bm->bm_free; |
54 | 54 | ||
55 | up(&AFFS_SB(sb)->s_bmlock); | 55 | mutex_unlock(&AFFS_SB(sb)->s_bmlock); |
56 | 56 | ||
57 | return free; | 57 | return free; |
58 | } | 58 | } |
@@ -76,7 +76,7 @@ affs_free_block(struct super_block *sb, u32 block) | |||
76 | bit = blk % sbi->s_bmap_bits; | 76 | bit = blk % sbi->s_bmap_bits; |
77 | bm = &sbi->s_bitmap[bmap]; | 77 | bm = &sbi->s_bitmap[bmap]; |
78 | 78 | ||
79 | down(&sbi->s_bmlock); | 79 | mutex_lock(&sbi->s_bmlock); |
80 | 80 | ||
81 | bh = sbi->s_bmap_bh; | 81 | bh = sbi->s_bmap_bh; |
82 | if (sbi->s_last_bmap != bmap) { | 82 | if (sbi->s_last_bmap != bmap) { |
@@ -105,19 +105,19 @@ affs_free_block(struct super_block *sb, u32 block) | |||
105 | sb->s_dirt = 1; | 105 | sb->s_dirt = 1; |
106 | bm->bm_free++; | 106 | bm->bm_free++; |
107 | 107 | ||
108 | up(&sbi->s_bmlock); | 108 | mutex_unlock(&sbi->s_bmlock); |
109 | return; | 109 | return; |
110 | 110 | ||
111 | err_free: | 111 | err_free: |
112 | affs_warning(sb,"affs_free_block","Trying to free block %u which is already free", block); | 112 | affs_warning(sb,"affs_free_block","Trying to free block %u which is already free", block); |
113 | up(&sbi->s_bmlock); | 113 | mutex_unlock(&sbi->s_bmlock); |
114 | return; | 114 | return; |
115 | 115 | ||
116 | err_bh_read: | 116 | err_bh_read: |
117 | affs_error(sb,"affs_free_block","Cannot read bitmap block %u", bm->bm_key); | 117 | affs_error(sb,"affs_free_block","Cannot read bitmap block %u", bm->bm_key); |
118 | sbi->s_bmap_bh = NULL; | 118 | sbi->s_bmap_bh = NULL; |
119 | sbi->s_last_bmap = ~0; | 119 | sbi->s_last_bmap = ~0; |
120 | up(&sbi->s_bmlock); | 120 | mutex_unlock(&sbi->s_bmlock); |
121 | return; | 121 | return; |
122 | 122 | ||
123 | err_range: | 123 | err_range: |
@@ -168,7 +168,7 @@ affs_alloc_block(struct inode *inode, u32 goal) | |||
168 | bmap = blk / sbi->s_bmap_bits; | 168 | bmap = blk / sbi->s_bmap_bits; |
169 | bm = &sbi->s_bitmap[bmap]; | 169 | bm = &sbi->s_bitmap[bmap]; |
170 | 170 | ||
171 | down(&sbi->s_bmlock); | 171 | mutex_lock(&sbi->s_bmlock); |
172 | 172 | ||
173 | if (bm->bm_free) | 173 | if (bm->bm_free) |
174 | goto find_bmap_bit; | 174 | goto find_bmap_bit; |
@@ -249,7 +249,7 @@ find_bit: | |||
249 | mark_buffer_dirty(bh); | 249 | mark_buffer_dirty(bh); |
250 | sb->s_dirt = 1; | 250 | sb->s_dirt = 1; |
251 | 251 | ||
252 | up(&sbi->s_bmlock); | 252 | mutex_unlock(&sbi->s_bmlock); |
253 | 253 | ||
254 | pr_debug("%d\n", blk); | 254 | pr_debug("%d\n", blk); |
255 | return blk; | 255 | return blk; |
@@ -259,7 +259,7 @@ err_bh_read: | |||
259 | sbi->s_bmap_bh = NULL; | 259 | sbi->s_bmap_bh = NULL; |
260 | sbi->s_last_bmap = ~0; | 260 | sbi->s_last_bmap = ~0; |
261 | err_full: | 261 | err_full: |
262 | up(&sbi->s_bmlock); | 262 | mutex_unlock(&sbi->s_bmlock); |
263 | pr_debug("failed\n"); | 263 | pr_debug("failed\n"); |
264 | return 0; | 264 | return 0; |
265 | } | 265 | } |