aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/wbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/wbuf.c')
-rw-r--r--fs/jffs2/wbuf.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index ba49f19cff85..8de52b607678 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -578,8 +578,8 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad)
578 if (!jffs2_is_writebuffered(c)) 578 if (!jffs2_is_writebuffered(c))
579 return 0; 579 return 0;
580 580
581 if (!down_trylock(&c->alloc_sem)) { 581 if (mutex_trylock(&c->alloc_sem)) {
582 up(&c->alloc_sem); 582 mutex_unlock(&c->alloc_sem);
583 printk(KERN_CRIT "jffs2_flush_wbuf() called with alloc_sem not locked!\n"); 583 printk(KERN_CRIT "jffs2_flush_wbuf() called with alloc_sem not locked!\n");
584 BUG(); 584 BUG();
585 } 585 }
@@ -702,10 +702,10 @@ int jffs2_flush_wbuf_gc(struct jffs2_sb_info *c, uint32_t ino)
702 if (!c->wbuf) 702 if (!c->wbuf)
703 return 0; 703 return 0;
704 704
705 down(&c->alloc_sem); 705 mutex_lock(&c->alloc_sem);
706 if (!jffs2_wbuf_pending_for_ino(c, ino)) { 706 if (!jffs2_wbuf_pending_for_ino(c, ino)) {
707 D1(printk(KERN_DEBUG "Ino #%d not pending in wbuf. Returning\n", ino)); 707 D1(printk(KERN_DEBUG "Ino #%d not pending in wbuf. Returning\n", ino));
708 up(&c->alloc_sem); 708 mutex_unlock(&c->alloc_sem);
709 return 0; 709 return 0;
710 } 710 }
711 711
@@ -725,14 +725,14 @@ int jffs2_flush_wbuf_gc(struct jffs2_sb_info *c, uint32_t ino)
725 } else while (old_wbuf_len && 725 } else while (old_wbuf_len &&
726 old_wbuf_ofs == c->wbuf_ofs) { 726 old_wbuf_ofs == c->wbuf_ofs) {
727 727
728 up(&c->alloc_sem); 728 mutex_unlock(&c->alloc_sem);
729 729
730 D1(printk(KERN_DEBUG "jffs2_flush_wbuf_gc() calls gc pass\n")); 730 D1(printk(KERN_DEBUG "jffs2_flush_wbuf_gc() calls gc pass\n"));
731 731
732 ret = jffs2_garbage_collect_pass(c); 732 ret = jffs2_garbage_collect_pass(c);
733 if (ret) { 733 if (ret) {
734 /* GC failed. Flush it with padding instead */ 734 /* GC failed. Flush it with padding instead */
735 down(&c->alloc_sem); 735 mutex_lock(&c->alloc_sem);
736 down_write(&c->wbuf_sem); 736 down_write(&c->wbuf_sem);
737 ret = __jffs2_flush_wbuf(c, PAD_ACCOUNTING); 737 ret = __jffs2_flush_wbuf(c, PAD_ACCOUNTING);
738 /* retry flushing wbuf in case jffs2_wbuf_recover 738 /* retry flushing wbuf in case jffs2_wbuf_recover
@@ -742,12 +742,12 @@ int jffs2_flush_wbuf_gc(struct jffs2_sb_info *c, uint32_t ino)
742 up_write(&c->wbuf_sem); 742 up_write(&c->wbuf_sem);
743 break; 743 break;
744 } 744 }
745 down(&c->alloc_sem); 745 mutex_lock(&c->alloc_sem);
746 } 746 }
747 747
748 D1(printk(KERN_DEBUG "jffs2_flush_wbuf_gc() ends...\n")); 748 D1(printk(KERN_DEBUG "jffs2_flush_wbuf_gc() ends...\n"));
749 749
750 up(&c->alloc_sem); 750 mutex_unlock(&c->alloc_sem);
751 return ret; 751 return ret;
752} 752}
753 753