aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-23 06:00:40 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 10:38:13 -0500
commit1eb0d67007e75697a7b87e6b611be935a991395c (patch)
tree35ce5e6313f89d2ef054870734d52b17388fe001
parent910f5d202ce39cc78de1bbb679285a3167de9fb2 (diff)
[PATCH] sem2mutex: JFFS
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> Cc: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/jffs/inode-v23.c86
-rw-r--r--fs/jffs/intrep.c6
-rw-r--r--fs/jffs/jffs_fm.c2
-rw-r--r--fs/jffs/jffs_fm.h5
4 files changed, 50 insertions, 49 deletions
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c
index fc3855a1aef3..890d7ff7456d 100644
--- a/fs/jffs/inode-v23.c
+++ b/fs/jffs/inode-v23.c
@@ -42,7 +42,7 @@
42#include <linux/quotaops.h> 42#include <linux/quotaops.h>
43#include <linux/highmem.h> 43#include <linux/highmem.h>
44#include <linux/vfs.h> 44#include <linux/vfs.h>
45#include <asm/semaphore.h> 45#include <linux/mutex.h>
46#include <asm/byteorder.h> 46#include <asm/byteorder.h>
47#include <asm/uaccess.h> 47#include <asm/uaccess.h>
48 48
@@ -203,7 +203,7 @@ jffs_setattr(struct dentry *dentry, struct iattr *iattr)
203 fmc = c->fmc; 203 fmc = c->fmc;
204 204
205 D3(printk (KERN_NOTICE "notify_change(): down biglock\n")); 205 D3(printk (KERN_NOTICE "notify_change(): down biglock\n"));
206 down(&fmc->biglock); 206 mutex_lock(&fmc->biglock);
207 207
208 f = jffs_find_file(c, inode->i_ino); 208 f = jffs_find_file(c, inode->i_ino);
209 209
@@ -211,7 +211,7 @@ jffs_setattr(struct dentry *dentry, struct iattr *iattr)
211 printk("jffs_setattr(): Invalid inode number: %lu\n", 211 printk("jffs_setattr(): Invalid inode number: %lu\n",
212 inode->i_ino); 212 inode->i_ino);
213 D3(printk (KERN_NOTICE "notify_change(): up biglock\n")); 213 D3(printk (KERN_NOTICE "notify_change(): up biglock\n"));
214 up(&fmc->biglock); 214 mutex_unlock(&fmc->biglock);
215 res = -EINVAL; 215 res = -EINVAL;
216 goto out; 216 goto out;
217 }); 217 });
@@ -232,7 +232,7 @@ jffs_setattr(struct dentry *dentry, struct iattr *iattr)
232 if (!(new_node = jffs_alloc_node())) { 232 if (!(new_node = jffs_alloc_node())) {
233 D(printk("jffs_setattr(): Allocation failed!\n")); 233 D(printk("jffs_setattr(): Allocation failed!\n"));
234 D3(printk (KERN_NOTICE "notify_change(): up biglock\n")); 234 D3(printk (KERN_NOTICE "notify_change(): up biglock\n"));
235 up(&fmc->biglock); 235 mutex_unlock(&fmc->biglock);
236 res = -ENOMEM; 236 res = -ENOMEM;
237 goto out; 237 goto out;
238 } 238 }
@@ -319,7 +319,7 @@ jffs_setattr(struct dentry *dentry, struct iattr *iattr)
319 D(printk("jffs_notify_change(): The write failed!\n")); 319 D(printk("jffs_notify_change(): The write failed!\n"));
320 jffs_free_node(new_node); 320 jffs_free_node(new_node);
321 D3(printk (KERN_NOTICE "n_c(): up biglock\n")); 321 D3(printk (KERN_NOTICE "n_c(): up biglock\n"));
322 up(&c->fmc->biglock); 322 mutex_unlock(&c->fmc->biglock);
323 goto out; 323 goto out;
324 } 324 }
325 325
@@ -327,7 +327,7 @@ jffs_setattr(struct dentry *dentry, struct iattr *iattr)
327 327
328 mark_inode_dirty(inode); 328 mark_inode_dirty(inode);
329 D3(printk (KERN_NOTICE "n_c(): up biglock\n")); 329 D3(printk (KERN_NOTICE "n_c(): up biglock\n"));
330 up(&c->fmc->biglock); 330 mutex_unlock(&c->fmc->biglock);
331out: 331out:
332 unlock_kernel(); 332 unlock_kernel();
333 return res; 333 return res;
@@ -461,7 +461,7 @@ jffs_rename(struct inode *old_dir, struct dentry *old_dentry,
461 goto jffs_rename_end; 461 goto jffs_rename_end;
462 } 462 }
463 D3(printk (KERN_NOTICE "rename(): down biglock\n")); 463 D3(printk (KERN_NOTICE "rename(): down biglock\n"));
464 down(&c->fmc->biglock); 464 mutex_lock(&c->fmc->biglock);
465 /* Create a node and initialize as much as needed. */ 465 /* Create a node and initialize as much as needed. */
466 result = -ENOMEM; 466 result = -ENOMEM;
467 if (!(node = jffs_alloc_node())) { 467 if (!(node = jffs_alloc_node())) {
@@ -555,7 +555,7 @@ jffs_rename(struct inode *old_dir, struct dentry *old_dentry,
555 555
556jffs_rename_end: 556jffs_rename_end:
557 D3(printk (KERN_NOTICE "rename(): up biglock\n")); 557 D3(printk (KERN_NOTICE "rename(): up biglock\n"));
558 up(&c->fmc->biglock); 558 mutex_unlock(&c->fmc->biglock);
559 unlock_kernel(); 559 unlock_kernel();
560 return result; 560 return result;
561} /* jffs_rename() */ 561} /* jffs_rename() */
@@ -574,14 +574,14 @@ jffs_readdir(struct file *filp, void *dirent, filldir_t filldir)
574 int ddino; 574 int ddino;
575 lock_kernel(); 575 lock_kernel();
576 D3(printk (KERN_NOTICE "readdir(): down biglock\n")); 576 D3(printk (KERN_NOTICE "readdir(): down biglock\n"));
577 down(&c->fmc->biglock); 577 mutex_lock(&c->fmc->biglock);
578 578
579 D2(printk("jffs_readdir(): inode: 0x%p, filp: 0x%p\n", inode, filp)); 579 D2(printk("jffs_readdir(): inode: 0x%p, filp: 0x%p\n", inode, filp));
580 if (filp->f_pos == 0) { 580 if (filp->f_pos == 0) {
581 D3(printk("jffs_readdir(): \".\" %lu\n", inode->i_ino)); 581 D3(printk("jffs_readdir(): \".\" %lu\n", inode->i_ino));
582 if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino, DT_DIR) < 0) { 582 if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino, DT_DIR) < 0) {
583 D3(printk (KERN_NOTICE "readdir(): up biglock\n")); 583 D3(printk (KERN_NOTICE "readdir(): up biglock\n"));
584 up(&c->fmc->biglock); 584 mutex_unlock(&c->fmc->biglock);
585 unlock_kernel(); 585 unlock_kernel();
586 return 0; 586 return 0;
587 } 587 }
@@ -598,7 +598,7 @@ jffs_readdir(struct file *filp, void *dirent, filldir_t filldir)
598 D3(printk("jffs_readdir(): \"..\" %u\n", ddino)); 598 D3(printk("jffs_readdir(): \"..\" %u\n", ddino));
599 if (filldir(dirent, "..", 2, filp->f_pos, ddino, DT_DIR) < 0) { 599 if (filldir(dirent, "..", 2, filp->f_pos, ddino, DT_DIR) < 0) {
600 D3(printk (KERN_NOTICE "readdir(): up biglock\n")); 600 D3(printk (KERN_NOTICE "readdir(): up biglock\n"));
601 up(&c->fmc->biglock); 601 mutex_unlock(&c->fmc->biglock);
602 unlock_kernel(); 602 unlock_kernel();
603 return 0; 603 return 0;
604 } 604 }
@@ -617,7 +617,7 @@ jffs_readdir(struct file *filp, void *dirent, filldir_t filldir)
617 if (filldir(dirent, f->name, f->nsize, 617 if (filldir(dirent, f->name, f->nsize,
618 filp->f_pos , f->ino, DT_UNKNOWN) < 0) { 618 filp->f_pos , f->ino, DT_UNKNOWN) < 0) {
619 D3(printk (KERN_NOTICE "readdir(): up biglock\n")); 619 D3(printk (KERN_NOTICE "readdir(): up biglock\n"));
620 up(&c->fmc->biglock); 620 mutex_unlock(&c->fmc->biglock);
621 unlock_kernel(); 621 unlock_kernel();
622 return 0; 622 return 0;
623 } 623 }
@@ -627,7 +627,7 @@ jffs_readdir(struct file *filp, void *dirent, filldir_t filldir)
627 } while(f && f->deleted); 627 } while(f && f->deleted);
628 } 628 }
629 D3(printk (KERN_NOTICE "readdir(): up biglock\n")); 629 D3(printk (KERN_NOTICE "readdir(): up biglock\n"));
630 up(&c->fmc->biglock); 630 mutex_unlock(&c->fmc->biglock);
631 unlock_kernel(); 631 unlock_kernel();
632 return filp->f_pos; 632 return filp->f_pos;
633} /* jffs_readdir() */ 633} /* jffs_readdir() */
@@ -660,7 +660,7 @@ jffs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
660 }); 660 });
661 661
662 D3(printk (KERN_NOTICE "lookup(): down biglock\n")); 662 D3(printk (KERN_NOTICE "lookup(): down biglock\n"));
663 down(&c->fmc->biglock); 663 mutex_lock(&c->fmc->biglock);
664 664
665 r = -ENAMETOOLONG; 665 r = -ENAMETOOLONG;
666 if (len > JFFS_MAX_NAME_LEN) { 666 if (len > JFFS_MAX_NAME_LEN) {
@@ -683,31 +683,31 @@ jffs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
683 683
684 if ((len == 1) && (name[0] == '.')) { 684 if ((len == 1) && (name[0] == '.')) {
685 D3(printk (KERN_NOTICE "lookup(): up biglock\n")); 685 D3(printk (KERN_NOTICE "lookup(): up biglock\n"));
686 up(&c->fmc->biglock); 686 mutex_unlock(&c->fmc->biglock);
687 if (!(inode = iget(dir->i_sb, d->ino))) { 687 if (!(inode = iget(dir->i_sb, d->ino))) {
688 D(printk("jffs_lookup(): . iget() ==> NULL\n")); 688 D(printk("jffs_lookup(): . iget() ==> NULL\n"));
689 goto jffs_lookup_end_no_biglock; 689 goto jffs_lookup_end_no_biglock;
690 } 690 }
691 D3(printk (KERN_NOTICE "lookup(): down biglock\n")); 691 D3(printk (KERN_NOTICE "lookup(): down biglock\n"));
692 down(&c->fmc->biglock); 692 mutex_lock(&c->fmc->biglock);
693 } else if ((len == 2) && (name[0] == '.') && (name[1] == '.')) { 693 } else if ((len == 2) && (name[0] == '.') && (name[1] == '.')) {
694 D3(printk (KERN_NOTICE "lookup(): up biglock\n")); 694 D3(printk (KERN_NOTICE "lookup(): up biglock\n"));
695 up(&c->fmc->biglock); 695 mutex_unlock(&c->fmc->biglock);
696 if (!(inode = iget(dir->i_sb, d->pino))) { 696 if (!(inode = iget(dir->i_sb, d->pino))) {
697 D(printk("jffs_lookup(): .. iget() ==> NULL\n")); 697 D(printk("jffs_lookup(): .. iget() ==> NULL\n"));
698 goto jffs_lookup_end_no_biglock; 698 goto jffs_lookup_end_no_biglock;
699 } 699 }
700 D3(printk (KERN_NOTICE "lookup(): down biglock\n")); 700 D3(printk (KERN_NOTICE "lookup(): down biglock\n"));
701 down(&c->fmc->biglock); 701 mutex_lock(&c->fmc->biglock);
702 } else if ((f = jffs_find_child(d, name, len))) { 702 } else if ((f = jffs_find_child(d, name, len))) {
703 D3(printk (KERN_NOTICE "lookup(): up biglock\n")); 703 D3(printk (KERN_NOTICE "lookup(): up biglock\n"));
704 up(&c->fmc->biglock); 704 mutex_unlock(&c->fmc->biglock);
705 if (!(inode = iget(dir->i_sb, f->ino))) { 705 if (!(inode = iget(dir->i_sb, f->ino))) {
706 D(printk("jffs_lookup(): iget() ==> NULL\n")); 706 D(printk("jffs_lookup(): iget() ==> NULL\n"));
707 goto jffs_lookup_end_no_biglock; 707 goto jffs_lookup_end_no_biglock;
708 } 708 }
709 D3(printk (KERN_NOTICE "lookup(): down biglock\n")); 709 D3(printk (KERN_NOTICE "lookup(): down biglock\n"));
710 down(&c->fmc->biglock); 710 mutex_lock(&c->fmc->biglock);
711 } else { 711 } else {
712 D3(printk("jffs_lookup(): Couldn't find the file. " 712 D3(printk("jffs_lookup(): Couldn't find the file. "
713 "f = 0x%p, name = \"%s\", d = 0x%p, d->ino = %u\n", 713 "f = 0x%p, name = \"%s\", d = 0x%p, d->ino = %u\n",
@@ -717,13 +717,13 @@ jffs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
717 717
718 d_add(dentry, inode); 718 d_add(dentry, inode);
719 D3(printk (KERN_NOTICE "lookup(): up biglock\n")); 719 D3(printk (KERN_NOTICE "lookup(): up biglock\n"));
720 up(&c->fmc->biglock); 720 mutex_unlock(&c->fmc->biglock);
721 unlock_kernel(); 721 unlock_kernel();
722 return NULL; 722 return NULL;
723 723
724jffs_lookup_end: 724jffs_lookup_end:
725 D3(printk (KERN_NOTICE "lookup(): up biglock\n")); 725 D3(printk (KERN_NOTICE "lookup(): up biglock\n"));
726 up(&c->fmc->biglock); 726 mutex_unlock(&c->fmc->biglock);
727 727
728jffs_lookup_end_no_biglock: 728jffs_lookup_end_no_biglock:
729 unlock_kernel(); 729 unlock_kernel();
@@ -753,7 +753,7 @@ jffs_do_readpage_nolock(struct file *file, struct page *page)
753 ClearPageError(page); 753 ClearPageError(page);
754 754
755 D3(printk (KERN_NOTICE "readpage(): down biglock\n")); 755 D3(printk (KERN_NOTICE "readpage(): down biglock\n"));
756 down(&c->fmc->biglock); 756 mutex_lock(&c->fmc->biglock);
757 757
758 read_len = 0; 758 read_len = 0;
759 result = 0; 759 result = 0;
@@ -782,7 +782,7 @@ jffs_do_readpage_nolock(struct file *file, struct page *page)
782 kunmap(page); 782 kunmap(page);
783 783
784 D3(printk (KERN_NOTICE "readpage(): up biglock\n")); 784 D3(printk (KERN_NOTICE "readpage(): up biglock\n"));
785 up(&c->fmc->biglock); 785 mutex_unlock(&c->fmc->biglock);
786 786
787 if (result) { 787 if (result) {
788 SetPageError(page); 788 SetPageError(page);
@@ -839,7 +839,7 @@ jffs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
839 839
840 c = dir_f->c; 840 c = dir_f->c;
841 D3(printk (KERN_NOTICE "mkdir(): down biglock\n")); 841 D3(printk (KERN_NOTICE "mkdir(): down biglock\n"));
842 down(&c->fmc->biglock); 842 mutex_lock(&c->fmc->biglock);
843 843
844 dir_mode = S_IFDIR | (mode & (S_IRWXUGO|S_ISVTX) 844 dir_mode = S_IFDIR | (mode & (S_IRWXUGO|S_ISVTX)
845 & ~current->fs->umask); 845 & ~current->fs->umask);
@@ -906,7 +906,7 @@ jffs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
906 result = 0; 906 result = 0;
907jffs_mkdir_end: 907jffs_mkdir_end:
908 D3(printk (KERN_NOTICE "mkdir(): up biglock\n")); 908 D3(printk (KERN_NOTICE "mkdir(): up biglock\n"));
909 up(&c->fmc->biglock); 909 mutex_unlock(&c->fmc->biglock);
910 unlock_kernel(); 910 unlock_kernel();
911 return result; 911 return result;
912} /* jffs_mkdir() */ 912} /* jffs_mkdir() */
@@ -921,10 +921,10 @@ jffs_rmdir(struct inode *dir, struct dentry *dentry)
921 D3(printk("***jffs_rmdir()\n")); 921 D3(printk("***jffs_rmdir()\n"));
922 D3(printk (KERN_NOTICE "rmdir(): down biglock\n")); 922 D3(printk (KERN_NOTICE "rmdir(): down biglock\n"));
923 lock_kernel(); 923 lock_kernel();
924 down(&c->fmc->biglock); 924 mutex_lock(&c->fmc->biglock);
925 ret = jffs_remove(dir, dentry, S_IFDIR); 925 ret = jffs_remove(dir, dentry, S_IFDIR);
926 D3(printk (KERN_NOTICE "rmdir(): up biglock\n")); 926 D3(printk (KERN_NOTICE "rmdir(): up biglock\n"));
927 up(&c->fmc->biglock); 927 mutex_unlock(&c->fmc->biglock);
928 unlock_kernel(); 928 unlock_kernel();
929 return ret; 929 return ret;
930} 930}
@@ -940,10 +940,10 @@ jffs_unlink(struct inode *dir, struct dentry *dentry)
940 lock_kernel(); 940 lock_kernel();
941 D3(printk("***jffs_unlink()\n")); 941 D3(printk("***jffs_unlink()\n"));
942 D3(printk (KERN_NOTICE "unlink(): down biglock\n")); 942 D3(printk (KERN_NOTICE "unlink(): down biglock\n"));
943 down(&c->fmc->biglock); 943 mutex_lock(&c->fmc->biglock);
944 ret = jffs_remove(dir, dentry, 0); 944 ret = jffs_remove(dir, dentry, 0);
945 D3(printk (KERN_NOTICE "unlink(): up biglock\n")); 945 D3(printk (KERN_NOTICE "unlink(): up biglock\n"));
946 up(&c->fmc->biglock); 946 mutex_unlock(&c->fmc->biglock);
947 unlock_kernel(); 947 unlock_kernel();
948 return ret; 948 return ret;
949} 949}
@@ -1086,7 +1086,7 @@ jffs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
1086 c = dir_f->c; 1086 c = dir_f->c;
1087 1087
1088 D3(printk (KERN_NOTICE "mknod(): down biglock\n")); 1088 D3(printk (KERN_NOTICE "mknod(): down biglock\n"));
1089 down(&c->fmc->biglock); 1089 mutex_lock(&c->fmc->biglock);
1090 1090
1091 /* Create and initialize a new node. */ 1091 /* Create and initialize a new node. */
1092 if (!(node = jffs_alloc_node())) { 1092 if (!(node = jffs_alloc_node())) {
@@ -1152,7 +1152,7 @@ jffs_mknod_err:
1152 1152
1153jffs_mknod_end: 1153jffs_mknod_end:
1154 D3(printk (KERN_NOTICE "mknod(): up biglock\n")); 1154 D3(printk (KERN_NOTICE "mknod(): up biglock\n"));
1155 up(&c->fmc->biglock); 1155 mutex_unlock(&c->fmc->biglock);
1156 unlock_kernel(); 1156 unlock_kernel();
1157 return result; 1157 return result;
1158} /* jffs_mknod() */ 1158} /* jffs_mknod() */
@@ -1203,7 +1203,7 @@ jffs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
1203 return -ENOMEM; 1203 return -ENOMEM;
1204 } 1204 }
1205 D3(printk (KERN_NOTICE "symlink(): down biglock\n")); 1205 D3(printk (KERN_NOTICE "symlink(): down biglock\n"));
1206 down(&c->fmc->biglock); 1206 mutex_lock(&c->fmc->biglock);
1207 1207
1208 node->data_offset = 0; 1208 node->data_offset = 0;
1209 node->removed_size = 0; 1209 node->removed_size = 0;
@@ -1253,7 +1253,7 @@ jffs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
1253 d_instantiate(dentry, inode); 1253 d_instantiate(dentry, inode);
1254 jffs_symlink_end: 1254 jffs_symlink_end:
1255 D3(printk (KERN_NOTICE "symlink(): up biglock\n")); 1255 D3(printk (KERN_NOTICE "symlink(): up biglock\n"));
1256 up(&c->fmc->biglock); 1256 mutex_unlock(&c->fmc->biglock);
1257 unlock_kernel(); 1257 unlock_kernel();
1258 return err; 1258 return err;
1259} /* jffs_symlink() */ 1259} /* jffs_symlink() */
@@ -1306,7 +1306,7 @@ jffs_create(struct inode *dir, struct dentry *dentry, int mode,
1306 return -ENOMEM; 1306 return -ENOMEM;
1307 } 1307 }
1308 D3(printk (KERN_NOTICE "create(): down biglock\n")); 1308 D3(printk (KERN_NOTICE "create(): down biglock\n"));
1309 down(&c->fmc->biglock); 1309 mutex_lock(&c->fmc->biglock);
1310 1310
1311 node->data_offset = 0; 1311 node->data_offset = 0;
1312 node->removed_size = 0; 1312 node->removed_size = 0;
@@ -1359,7 +1359,7 @@ jffs_create(struct inode *dir, struct dentry *dentry, int mode,
1359 d_instantiate(dentry, inode); 1359 d_instantiate(dentry, inode);
1360 jffs_create_end: 1360 jffs_create_end:
1361 D3(printk (KERN_NOTICE "create(): up biglock\n")); 1361 D3(printk (KERN_NOTICE "create(): up biglock\n"));
1362 up(&c->fmc->biglock); 1362 mutex_unlock(&c->fmc->biglock);
1363 unlock_kernel(); 1363 unlock_kernel();
1364 return err; 1364 return err;
1365} /* jffs_create() */ 1365} /* jffs_create() */
@@ -1423,7 +1423,7 @@ jffs_file_write(struct file *filp, const char *buf, size_t count,
1423 thiscount = min(c->fmc->max_chunk_size - sizeof(struct jffs_raw_inode), count); 1423 thiscount = min(c->fmc->max_chunk_size - sizeof(struct jffs_raw_inode), count);
1424 1424
1425 D3(printk (KERN_NOTICE "file_write(): down biglock\n")); 1425 D3(printk (KERN_NOTICE "file_write(): down biglock\n"));
1426 down(&c->fmc->biglock); 1426 mutex_lock(&c->fmc->biglock);
1427 1427
1428 /* Urgh. POSIX says we can do short writes if we feel like it. 1428 /* Urgh. POSIX says we can do short writes if we feel like it.
1429 * In practice, we can't. Nothing will cope. So we loop until 1429 * In practice, we can't. Nothing will cope. So we loop until
@@ -1511,7 +1511,7 @@ jffs_file_write(struct file *filp, const char *buf, size_t count,
1511 } 1511 }
1512 out: 1512 out:
1513 D3(printk (KERN_NOTICE "file_write(): up biglock\n")); 1513 D3(printk (KERN_NOTICE "file_write(): up biglock\n"));
1514 up(&c->fmc->biglock); 1514 mutex_unlock(&c->fmc->biglock);
1515 1515
1516 /* Fix things in the real inode. */ 1516 /* Fix things in the real inode. */
1517 if (pos > inode->i_size) { 1517 if (pos > inode->i_size) {
@@ -1567,7 +1567,7 @@ jffs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1567 return -EIO; 1567 return -EIO;
1568 } 1568 }
1569 D3(printk (KERN_NOTICE "ioctl(): down biglock\n")); 1569 D3(printk (KERN_NOTICE "ioctl(): down biglock\n"));
1570 down(&c->fmc->biglock); 1570 mutex_lock(&c->fmc->biglock);
1571 1571
1572 switch (cmd) { 1572 switch (cmd) {
1573 case JFFS_PRINT_HASH: 1573 case JFFS_PRINT_HASH:
@@ -1609,7 +1609,7 @@ jffs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1609 ret = -ENOTTY; 1609 ret = -ENOTTY;
1610 } 1610 }
1611 D3(printk (KERN_NOTICE "ioctl(): up biglock\n")); 1611 D3(printk (KERN_NOTICE "ioctl(): up biglock\n"));
1612 up(&c->fmc->biglock); 1612 mutex_unlock(&c->fmc->biglock);
1613 return ret; 1613 return ret;
1614} /* jffs_ioctl() */ 1614} /* jffs_ioctl() */
1615 1615
@@ -1685,12 +1685,12 @@ jffs_read_inode(struct inode *inode)
1685 } 1685 }
1686 c = (struct jffs_control *)inode->i_sb->s_fs_info; 1686 c = (struct jffs_control *)inode->i_sb->s_fs_info;
1687 D3(printk (KERN_NOTICE "read_inode(): down biglock\n")); 1687 D3(printk (KERN_NOTICE "read_inode(): down biglock\n"));
1688 down(&c->fmc->biglock); 1688 mutex_lock(&c->fmc->biglock);
1689 if (!(f = jffs_find_file(c, inode->i_ino))) { 1689 if (!(f = jffs_find_file(c, inode->i_ino))) {
1690 D(printk("jffs_read_inode(): No such inode (%lu).\n", 1690 D(printk("jffs_read_inode(): No such inode (%lu).\n",
1691 inode->i_ino)); 1691 inode->i_ino));
1692 D3(printk (KERN_NOTICE "read_inode(): up biglock\n")); 1692 D3(printk (KERN_NOTICE "read_inode(): up biglock\n"));
1693 up(&c->fmc->biglock); 1693 mutex_unlock(&c->fmc->biglock);
1694 return; 1694 return;
1695 } 1695 }
1696 inode->u.generic_ip = (void *)f; 1696 inode->u.generic_ip = (void *)f;
@@ -1732,7 +1732,7 @@ jffs_read_inode(struct inode *inode)
1732 } 1732 }
1733 1733
1734 D3(printk (KERN_NOTICE "read_inode(): up biglock\n")); 1734 D3(printk (KERN_NOTICE "read_inode(): up biglock\n"));
1735 up(&c->fmc->biglock); 1735 mutex_unlock(&c->fmc->biglock);
1736} 1736}
1737 1737
1738 1738
diff --git a/fs/jffs/intrep.c b/fs/jffs/intrep.c
index ce7b54b0b2b7..0ef207dfaf6f 100644
--- a/fs/jffs/intrep.c
+++ b/fs/jffs/intrep.c
@@ -62,7 +62,7 @@
62#include <linux/fs.h> 62#include <linux/fs.h>
63#include <linux/stat.h> 63#include <linux/stat.h>
64#include <linux/pagemap.h> 64#include <linux/pagemap.h>
65#include <asm/semaphore.h> 65#include <linux/mutex.h>
66#include <asm/byteorder.h> 66#include <asm/byteorder.h>
67#include <linux/smp_lock.h> 67#include <linux/smp_lock.h>
68#include <linux/time.h> 68#include <linux/time.h>
@@ -3416,7 +3416,7 @@ jffs_garbage_collect_thread(void *ptr)
3416 D1(printk (KERN_NOTICE "jffs_garbage_collect_thread(): collecting.\n")); 3416 D1(printk (KERN_NOTICE "jffs_garbage_collect_thread(): collecting.\n"));
3417 3417
3418 D3(printk (KERN_NOTICE "g_c_thread(): down biglock\n")); 3418 D3(printk (KERN_NOTICE "g_c_thread(): down biglock\n"));
3419 down(&fmc->biglock); 3419 mutex_lock(&fmc->biglock);
3420 3420
3421 D1(printk("***jffs_garbage_collect_thread(): round #%u, " 3421 D1(printk("***jffs_garbage_collect_thread(): round #%u, "
3422 "fmc->dirty_size = %u\n", i++, fmc->dirty_size)); 3422 "fmc->dirty_size = %u\n", i++, fmc->dirty_size));
@@ -3447,6 +3447,6 @@ jffs_garbage_collect_thread(void *ptr)
3447 3447
3448 gc_end: 3448 gc_end:
3449 D3(printk (KERN_NOTICE "g_c_thread(): up biglock\n")); 3449 D3(printk (KERN_NOTICE "g_c_thread(): up biglock\n"));
3450 up(&fmc->biglock); 3450 mutex_unlock(&fmc->biglock);
3451 } /* for (;;) */ 3451 } /* for (;;) */
3452} /* jffs_garbage_collect_thread() */ 3452} /* jffs_garbage_collect_thread() */
diff --git a/fs/jffs/jffs_fm.c b/fs/jffs/jffs_fm.c
index 6da13b309bd1..7d8ca1aeace2 100644
--- a/fs/jffs/jffs_fm.c
+++ b/fs/jffs/jffs_fm.c
@@ -139,7 +139,7 @@ jffs_build_begin(struct jffs_control *c, int unit)
139 fmc->tail = NULL; 139 fmc->tail = NULL;
140 fmc->head_extra = NULL; 140 fmc->head_extra = NULL;
141 fmc->tail_extra = NULL; 141 fmc->tail_extra = NULL;
142 init_MUTEX(&fmc->biglock); 142 mutex_init(&fmc->biglock);
143 return fmc; 143 return fmc;
144} 144}
145 145
diff --git a/fs/jffs/jffs_fm.h b/fs/jffs/jffs_fm.h
index f64151e74122..c794d923df2a 100644
--- a/fs/jffs/jffs_fm.h
+++ b/fs/jffs/jffs_fm.h
@@ -20,10 +20,11 @@
20#ifndef __LINUX_JFFS_FM_H__ 20#ifndef __LINUX_JFFS_FM_H__
21#define __LINUX_JFFS_FM_H__ 21#define __LINUX_JFFS_FM_H__
22 22
23#include <linux/config.h>
23#include <linux/types.h> 24#include <linux/types.h>
24#include <linux/jffs.h> 25#include <linux/jffs.h>
25#include <linux/mtd/mtd.h> 26#include <linux/mtd/mtd.h>
26#include <linux/config.h> 27#include <linux/mutex.h>
27 28
28/* The alignment between two nodes in the flash memory. */ 29/* The alignment between two nodes in the flash memory. */
29#define JFFS_ALIGN_SIZE 4 30#define JFFS_ALIGN_SIZE 4
@@ -97,7 +98,7 @@ struct jffs_fmcontrol
97 struct jffs_fm *tail; 98 struct jffs_fm *tail;
98 struct jffs_fm *head_extra; 99 struct jffs_fm *head_extra;
99 struct jffs_fm *tail_extra; 100 struct jffs_fm *tail_extra;
100 struct semaphore biglock; 101 struct mutex biglock;
101}; 102};
102 103
103/* Notice the two members head_extra and tail_extra in the jffs_control 104/* Notice the two members head_extra and tail_extra in the jffs_control