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 | |
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')
-rw-r--r-- | fs/affs/affs.h | 3 | ||||
-rw-r--r-- | fs/affs/bitmap.c | 18 | ||||
-rw-r--r-- | fs/affs/super.c | 2 |
3 files changed, 12 insertions, 11 deletions
diff --git a/fs/affs/affs.h b/fs/affs/affs.h index 223b1917093e..e9ec915f7553 100644 --- a/fs/affs/affs.h +++ b/fs/affs/affs.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <linux/fs.h> | 2 | #include <linux/fs.h> |
3 | #include <linux/buffer_head.h> | 3 | #include <linux/buffer_head.h> |
4 | #include <linux/amigaffs.h> | 4 | #include <linux/amigaffs.h> |
5 | #include <linux/mutex.h> | ||
5 | 6 | ||
6 | /* AmigaOS allows file names with up to 30 characters length. | 7 | /* AmigaOS allows file names with up to 30 characters length. |
7 | * Names longer than that will be silently truncated. If you | 8 | * Names longer than that will be silently truncated. If you |
@@ -98,7 +99,7 @@ struct affs_sb_info { | |||
98 | gid_t s_gid; /* gid to override */ | 99 | gid_t s_gid; /* gid to override */ |
99 | umode_t s_mode; /* mode to override */ | 100 | umode_t s_mode; /* mode to override */ |
100 | struct buffer_head *s_root_bh; /* Cached root block. */ | 101 | struct buffer_head *s_root_bh; /* Cached root block. */ |
101 | struct semaphore s_bmlock; /* Protects bitmap access. */ | 102 | struct mutex s_bmlock; /* Protects bitmap access. */ |
102 | struct affs_bm_info *s_bitmap; /* Bitmap infos. */ | 103 | struct affs_bm_info *s_bitmap; /* Bitmap infos. */ |
103 | u32 s_bmap_count; /* # of bitmap blocks. */ | 104 | u32 s_bmap_count; /* # of bitmap blocks. */ |
104 | u32 s_bmap_bits; /* # of bits in one bitmap blocks */ | 105 | u32 s_bmap_bits; /* # of bits in one bitmap blocks */ |
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 | } |
diff --git a/fs/affs/super.c b/fs/affs/super.c index d214837d5e42..4e0309566406 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
@@ -290,7 +290,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) | |||
290 | if (!sbi) | 290 | if (!sbi) |
291 | return -ENOMEM; | 291 | return -ENOMEM; |
292 | sb->s_fs_info = sbi; | 292 | sb->s_fs_info = sbi; |
293 | init_MUTEX(&sbi->s_bmlock); | 293 | mutex_init(&sbi->s_bmlock); |
294 | 294 | ||
295 | if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block, | 295 | if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block, |
296 | &blocksize,&sbi->s_prefix, | 296 | &blocksize,&sbi->s_prefix, |