717
718
719 if (ret)
720 ret = __jffs2_flush_wbuf(c, PAD_ACCOUNTING);
721 up_write(&c->wbuf_sem);
722 } else while (old_wbuf_len &&
723 old_wbuf_ofs == c->wbuf_ofs) {
724
725 mutex_unlock(&c->alloc_sem);
726
727 D1(printk(KERN_DEBUG "jffs2_flush_wbuf_gc() calls gc pass\n"));
728
729 ret = jffs2_garbage_collect_pass(c);
730 if (ret) {
731
732 mutex_lock(&c->alloc_sem);
733 down_write(&c->wbuf_sem);
734 ret = __jffs2_flush_wbuf(c, PAD_ACCOUNTING);
735
736
737 if (ret)
738 ret = __jffs2_flush_wbuf(c, PAD_ACCOUNTING);
739 up_write(&c->wbuf_sem);
740 break;
741 }
742 mutex_lock(&c->alloc_sem);
743 }
744
745 D1(printk(KERN_DEBUG "jffs2_flush_wbuf_gc() ends...\n"));
746
747 mutex_unlock(&c->alloc_sem);
748 return ret;
749}
750
751
752int jffs2_flush_wbuf_pad(struct jffs2_sb_info *c)
753{
754 int ret;
755
756 if (!c->wbuf)
757 return 0;