aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-23 06:00:42 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 10:38:13 -0500
commit7bf6d78dd93ccc52cd2cac5066c4b84834e4f1f2 (patch)
treed48db5d52dd3b9c7942d3af8ff1393bc4ed10d81 /fs
parent1d5599e397dcc7c2300d200e66dad326d7dbac38 (diff)
[PATCH] sem2mutex: HPFS
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/hpfs/hpfs_fn.h5
-rw-r--r--fs/hpfs/inode.c10
-rw-r--r--fs/hpfs/namei.c60
-rw-r--r--fs/hpfs/super.c4
4 files changed, 40 insertions, 39 deletions
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h
index 6628c3b352cb..4c6473ab3b34 100644
--- a/fs/hpfs/hpfs_fn.h
+++ b/fs/hpfs/hpfs_fn.h
@@ -9,6 +9,7 @@
9//#define DBG 9//#define DBG
10//#define DEBUG_LOCKS 10//#define DEBUG_LOCKS
11 11
12#include <linux/mutex.h>
12#include <linux/pagemap.h> 13#include <linux/pagemap.h>
13#include <linux/buffer_head.h> 14#include <linux/buffer_head.h>
14#include <linux/hpfs_fs.h> 15#include <linux/hpfs_fs.h>
@@ -57,8 +58,8 @@ struct hpfs_inode_info {
57 unsigned i_ea_uid : 1; /* file's uid is stored in ea */ 58 unsigned i_ea_uid : 1; /* file's uid is stored in ea */
58 unsigned i_ea_gid : 1; /* file's gid is stored in ea */ 59 unsigned i_ea_gid : 1; /* file's gid is stored in ea */
59 unsigned i_dirty : 1; 60 unsigned i_dirty : 1;
60 struct semaphore i_sem; 61 struct mutex i_mutex;
61 struct semaphore i_parent; 62 struct mutex i_parent_mutex;
62 loff_t **i_rddir_off; 63 loff_t **i_rddir_off;
63 struct inode vfs_inode; 64 struct inode vfs_inode;
64}; 65};
diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c
index e3d17e9ea6c1..56f2c338c4d9 100644
--- a/fs/hpfs/inode.c
+++ b/fs/hpfs/inode.c
@@ -186,9 +186,9 @@ void hpfs_write_inode(struct inode *i)
186 kfree(hpfs_inode->i_rddir_off); 186 kfree(hpfs_inode->i_rddir_off);
187 hpfs_inode->i_rddir_off = NULL; 187 hpfs_inode->i_rddir_off = NULL;
188 } 188 }
189 down(&hpfs_inode->i_parent); 189 mutex_lock(&hpfs_inode->i_parent_mutex);
190 if (!i->i_nlink) { 190 if (!i->i_nlink) {
191 up(&hpfs_inode->i_parent); 191 mutex_unlock(&hpfs_inode->i_parent_mutex);
192 return; 192 return;
193 } 193 }
194 parent = iget_locked(i->i_sb, hpfs_inode->i_parent_dir); 194 parent = iget_locked(i->i_sb, hpfs_inode->i_parent_dir);
@@ -199,14 +199,14 @@ void hpfs_write_inode(struct inode *i)
199 hpfs_read_inode(parent); 199 hpfs_read_inode(parent);
200 unlock_new_inode(parent); 200 unlock_new_inode(parent);
201 } 201 }
202 down(&hpfs_inode->i_sem); 202 mutex_lock(&hpfs_inode->i_mutex);
203 hpfs_write_inode_nolock(i); 203 hpfs_write_inode_nolock(i);
204 up(&hpfs_inode->i_sem); 204 mutex_unlock(&hpfs_inode->i_mutex);
205 iput(parent); 205 iput(parent);
206 } else { 206 } else {
207 mark_inode_dirty(i); 207 mark_inode_dirty(i);
208 } 208 }
209 up(&hpfs_inode->i_parent); 209 mutex_unlock(&hpfs_inode->i_parent_mutex);
210} 210}
211 211
212void hpfs_write_inode_nolock(struct inode *i) 212void hpfs_write_inode_nolock(struct inode *i)
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index 8ff8fc433fc1..a03abb12c610 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -60,7 +60,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
60 if (dee.read_only) 60 if (dee.read_only)
61 result->i_mode &= ~0222; 61 result->i_mode &= ~0222;
62 62
63 down(&hpfs_i(dir)->i_sem); 63 mutex_lock(&hpfs_i(dir)->i_mutex);
64 r = hpfs_add_dirent(dir, (char *)name, len, &dee, 0); 64 r = hpfs_add_dirent(dir, (char *)name, len, &dee, 0);
65 if (r == 1) 65 if (r == 1)
66 goto bail3; 66 goto bail3;
@@ -101,11 +101,11 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
101 hpfs_write_inode_nolock(result); 101 hpfs_write_inode_nolock(result);
102 } 102 }
103 d_instantiate(dentry, result); 103 d_instantiate(dentry, result);
104 up(&hpfs_i(dir)->i_sem); 104 mutex_unlock(&hpfs_i(dir)->i_mutex);
105 unlock_kernel(); 105 unlock_kernel();
106 return 0; 106 return 0;
107bail3: 107bail3:
108 up(&hpfs_i(dir)->i_sem); 108 mutex_unlock(&hpfs_i(dir)->i_mutex);
109 iput(result); 109 iput(result);
110bail2: 110bail2:
111 hpfs_brelse4(&qbh0); 111 hpfs_brelse4(&qbh0);
@@ -168,7 +168,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc
168 result->i_data.a_ops = &hpfs_aops; 168 result->i_data.a_ops = &hpfs_aops;
169 hpfs_i(result)->mmu_private = 0; 169 hpfs_i(result)->mmu_private = 0;
170 170
171 down(&hpfs_i(dir)->i_sem); 171 mutex_lock(&hpfs_i(dir)->i_mutex);
172 r = hpfs_add_dirent(dir, (char *)name, len, &dee, 0); 172 r = hpfs_add_dirent(dir, (char *)name, len, &dee, 0);
173 if (r == 1) 173 if (r == 1)
174 goto bail2; 174 goto bail2;
@@ -193,12 +193,12 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc
193 hpfs_write_inode_nolock(result); 193 hpfs_write_inode_nolock(result);
194 } 194 }
195 d_instantiate(dentry, result); 195 d_instantiate(dentry, result);
196 up(&hpfs_i(dir)->i_sem); 196 mutex_unlock(&hpfs_i(dir)->i_mutex);
197 unlock_kernel(); 197 unlock_kernel();
198 return 0; 198 return 0;
199 199
200bail2: 200bail2:
201 up(&hpfs_i(dir)->i_sem); 201 mutex_unlock(&hpfs_i(dir)->i_mutex);
202 iput(result); 202 iput(result);
203bail1: 203bail1:
204 brelse(bh); 204 brelse(bh);
@@ -254,7 +254,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t
254 result->i_blocks = 1; 254 result->i_blocks = 1;
255 init_special_inode(result, mode, rdev); 255 init_special_inode(result, mode, rdev);
256 256
257 down(&hpfs_i(dir)->i_sem); 257 mutex_lock(&hpfs_i(dir)->i_mutex);
258 r = hpfs_add_dirent(dir, (char *)name, len, &dee, 0); 258 r = hpfs_add_dirent(dir, (char *)name, len, &dee, 0);
259 if (r == 1) 259 if (r == 1)
260 goto bail2; 260 goto bail2;
@@ -271,12 +271,12 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t
271 271
272 hpfs_write_inode_nolock(result); 272 hpfs_write_inode_nolock(result);
273 d_instantiate(dentry, result); 273 d_instantiate(dentry, result);
274 up(&hpfs_i(dir)->i_sem); 274 mutex_unlock(&hpfs_i(dir)->i_mutex);
275 brelse(bh); 275 brelse(bh);
276 unlock_kernel(); 276 unlock_kernel();
277 return 0; 277 return 0;
278bail2: 278bail2:
279 up(&hpfs_i(dir)->i_sem); 279 mutex_unlock(&hpfs_i(dir)->i_mutex);
280 iput(result); 280 iput(result);
281bail1: 281bail1:
282 brelse(bh); 282 brelse(bh);
@@ -333,7 +333,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy
333 result->i_op = &page_symlink_inode_operations; 333 result->i_op = &page_symlink_inode_operations;
334 result->i_data.a_ops = &hpfs_symlink_aops; 334 result->i_data.a_ops = &hpfs_symlink_aops;
335 335
336 down(&hpfs_i(dir)->i_sem); 336 mutex_lock(&hpfs_i(dir)->i_mutex);
337 r = hpfs_add_dirent(dir, (char *)name, len, &dee, 0); 337 r = hpfs_add_dirent(dir, (char *)name, len, &dee, 0);
338 if (r == 1) 338 if (r == 1)
339 goto bail2; 339 goto bail2;
@@ -352,11 +352,11 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy
352 352
353 hpfs_write_inode_nolock(result); 353 hpfs_write_inode_nolock(result);
354 d_instantiate(dentry, result); 354 d_instantiate(dentry, result);
355 up(&hpfs_i(dir)->i_sem); 355 mutex_unlock(&hpfs_i(dir)->i_mutex);
356 unlock_kernel(); 356 unlock_kernel();
357 return 0; 357 return 0;
358bail2: 358bail2:
359 up(&hpfs_i(dir)->i_sem); 359 mutex_unlock(&hpfs_i(dir)->i_mutex);
360 iput(result); 360 iput(result);
361bail1: 361bail1:
362 brelse(bh); 362 brelse(bh);
@@ -382,8 +382,8 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry)
382 lock_kernel(); 382 lock_kernel();
383 hpfs_adjust_length((char *)name, &len); 383 hpfs_adjust_length((char *)name, &len);
384again: 384again:
385 down(&hpfs_i(inode)->i_parent); 385 mutex_lock(&hpfs_i(inode)->i_parent_mutex);
386 down(&hpfs_i(dir)->i_sem); 386 mutex_lock(&hpfs_i(dir)->i_mutex);
387 err = -ENOENT; 387 err = -ENOENT;
388 de = map_dirent(dir, hpfs_i(dir)->i_dno, (char *)name, len, &dno, &qbh); 388 de = map_dirent(dir, hpfs_i(dir)->i_dno, (char *)name, len, &dno, &qbh);
389 if (!de) 389 if (!de)
@@ -410,8 +410,8 @@ again:
410 if (rep++) 410 if (rep++)
411 break; 411 break;
412 412
413 up(&hpfs_i(dir)->i_sem); 413 mutex_unlock(&hpfs_i(dir)->i_mutex);
414 up(&hpfs_i(inode)->i_parent); 414 mutex_unlock(&hpfs_i(inode)->i_parent_mutex);
415 d_drop(dentry); 415 d_drop(dentry);
416 spin_lock(&dentry->d_lock); 416 spin_lock(&dentry->d_lock);
417 if (atomic_read(&dentry->d_count) > 1 || 417 if (atomic_read(&dentry->d_count) > 1 ||
@@ -442,8 +442,8 @@ again:
442out1: 442out1:
443 hpfs_brelse4(&qbh); 443 hpfs_brelse4(&qbh);
444out: 444out:
445 up(&hpfs_i(dir)->i_sem); 445 mutex_unlock(&hpfs_i(dir)->i_mutex);
446 up(&hpfs_i(inode)->i_parent); 446 mutex_unlock(&hpfs_i(inode)->i_parent_mutex);
447 unlock_kernel(); 447 unlock_kernel();
448 return err; 448 return err;
449} 449}
@@ -463,8 +463,8 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
463 463
464 hpfs_adjust_length((char *)name, &len); 464 hpfs_adjust_length((char *)name, &len);
465 lock_kernel(); 465 lock_kernel();
466 down(&hpfs_i(inode)->i_parent); 466 mutex_lock(&hpfs_i(inode)->i_parent_mutex);
467 down(&hpfs_i(dir)->i_sem); 467 mutex_lock(&hpfs_i(dir)->i_mutex);
468 err = -ENOENT; 468 err = -ENOENT;
469 de = map_dirent(dir, hpfs_i(dir)->i_dno, (char *)name, len, &dno, &qbh); 469 de = map_dirent(dir, hpfs_i(dir)->i_dno, (char *)name, len, &dno, &qbh);
470 if (!de) 470 if (!de)
@@ -502,8 +502,8 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
502out1: 502out1:
503 hpfs_brelse4(&qbh); 503 hpfs_brelse4(&qbh);
504out: 504out:
505 up(&hpfs_i(dir)->i_sem); 505 mutex_unlock(&hpfs_i(dir)->i_mutex);
506 up(&hpfs_i(inode)->i_parent); 506 mutex_unlock(&hpfs_i(inode)->i_parent_mutex);
507 unlock_kernel(); 507 unlock_kernel();
508 return err; 508 return err;
509} 509}
@@ -565,12 +565,12 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
565 565
566 lock_kernel(); 566 lock_kernel();
567 /* order doesn't matter, due to VFS exclusion */ 567 /* order doesn't matter, due to VFS exclusion */
568 down(&hpfs_i(i)->i_parent); 568 mutex_lock(&hpfs_i(i)->i_parent_mutex);
569 if (new_inode) 569 if (new_inode)
570 down(&hpfs_i(new_inode)->i_parent); 570 mutex_lock(&hpfs_i(new_inode)->i_parent_mutex);
571 down(&hpfs_i(old_dir)->i_sem); 571 mutex_lock(&hpfs_i(old_dir)->i_mutex);
572 if (new_dir != old_dir) 572 if (new_dir != old_dir)
573 down(&hpfs_i(new_dir)->i_sem); 573 mutex_lock(&hpfs_i(new_dir)->i_mutex);
574 574
575 /* Erm? Moving over the empty non-busy directory is perfectly legal */ 575 /* Erm? Moving over the empty non-busy directory is perfectly legal */
576 if (new_inode && S_ISDIR(new_inode->i_mode)) { 576 if (new_inode && S_ISDIR(new_inode->i_mode)) {
@@ -650,11 +650,11 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
650 hpfs_decide_conv(i, (char *)new_name, new_len); 650 hpfs_decide_conv(i, (char *)new_name, new_len);
651end1: 651end1:
652 if (old_dir != new_dir) 652 if (old_dir != new_dir)
653 up(&hpfs_i(new_dir)->i_sem); 653 mutex_unlock(&hpfs_i(new_dir)->i_mutex);
654 up(&hpfs_i(old_dir)->i_sem); 654 mutex_unlock(&hpfs_i(old_dir)->i_mutex);
655 up(&hpfs_i(i)->i_parent); 655 mutex_unlock(&hpfs_i(i)->i_parent_mutex);
656 if (new_inode) 656 if (new_inode)
657 up(&hpfs_i(new_inode)->i_parent); 657 mutex_unlock(&hpfs_i(new_inode)->i_parent_mutex);
658 unlock_kernel(); 658 unlock_kernel();
659 return err; 659 return err;
660} 660}
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index 63e88d7e2c3b..9488a794076e 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -181,8 +181,8 @@ static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
181 181
182 if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == 182 if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
183 SLAB_CTOR_CONSTRUCTOR) { 183 SLAB_CTOR_CONSTRUCTOR) {
184 init_MUTEX(&ei->i_sem); 184 mutex_init(&ei->i_mutex);
185 init_MUTEX(&ei->i_parent); 185 mutex_init(&ei->i_parent_mutex);
186 inode_init_once(&ei->vfs_inode); 186 inode_init_once(&ei->vfs_inode);
187 } 187 }
188} 188}