mtd/fs/jffs2 erase.c,1.55,1.56 fs.c,1.33,1.34
nodelist.h,1.110,1.111 nodemgmt.c,1.105,1.106
David Woodhouse
dwmw2 at infradead.org
Mon Nov 3 12:33:58 EST 2003
Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv31016
Modified Files:
erase.c fs.c nodelist.h nodemgmt.c
Log Message:
Fix deadlock with kupdated, and bad performance, and eCos ifdef
Index: erase.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/erase.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- erase.c 16 Oct 2003 10:21:10 -0000 1.55
+++ erase.c 3 Nov 2003 17:33:54 -0000 1.56
@@ -101,7 +101,7 @@
jffs2_erase_failed(c, jeb);
}
-void jffs2_erase_pending_blocks(struct jffs2_sb_info *c)
+void jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count)
{
struct jffs2_eraseblock *jeb;
@@ -117,6 +117,11 @@
list_del(&jeb->list);
spin_unlock(&c->erase_completion_lock);
jffs2_mark_erased_block(c, jeb);
+
+ if (!--count) {
+ D1(printk(KERN_DEBUG "Count reached. jffs2_erase_pending_blocks leaving\n"));
+ break;
+ }
} else if (!list_empty(&c->erase_pending_list)) {
jeb = list_entry(c->erase_pending_list.next, struct jffs2_eraseblock, list);
Index: fs.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/fs.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- fs.c 2 Nov 2003 08:52:34 -0000 1.33
+++ fs.c 3 Nov 2003 17:33:54 -0000 1.34
@@ -365,7 +365,7 @@
D1(printk(KERN_DEBUG "jffs2_write_super()\n"));
jffs2_garbage_collect_trigger(c);
- jffs2_erase_pending_blocks(c);
+ jffs2_erase_pending_blocks(c, 0);
jffs2_flush_wbuf_gc(c, 0);
}
Index: nodelist.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/nodelist.h,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- nodelist.h 2 Nov 2003 19:28:42 -0000 1.110
+++ nodelist.h 3 Nov 2003 17:33:54 -0000 1.111
@@ -452,7 +452,7 @@
/* erase.c */
void jffs2_erase_block(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb);
-void jffs2_erase_pending_blocks(struct jffs2_sb_info *c);
+void jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count);
void jffs2_erase_pending_trigger(struct jffs2_sb_info *c);
#ifdef CONFIG_JFFS2_FS_NAND
Index: nodemgmt.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/nodemgmt.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- nodemgmt.c 2 Nov 2003 12:32:34 -0000 1.105
+++ nodemgmt.c 3 Nov 2003 17:33:54 -0000 1.106
@@ -209,8 +209,6 @@
if (list_empty(&c->free_list)) {
- DECLARE_WAITQUEUE(wait, current);
-
if (!c->nr_erasing_blocks &&
!list_empty(&c->erasable_list)) {
struct jffs2_eraseblock *ejeb;
@@ -243,30 +241,12 @@
list_empty(&c->erasing_list)?"yes":"no", list_empty(&c->erase_pending_list)?"yes":"no");
return -ENOSPC;
}
- /* Make sure this can't deadlock. Someone has to start the erases
- of erase_pending blocks */
-#ifdef __ECOS
- /* In eCos, we don't have a handy kernel thread doing the erases for
- us. We do them ourselves right now. */
- jffs2_erase_pending_blocks(c);
-#else
- set_current_state(TASK_INTERRUPTIBLE);
- add_wait_queue(&c->erase_wait, &wait);
- D1(printk(KERN_DEBUG "Waiting for erases to complete. erasing_blocks is %d. (erasableempty: %s, erasingempty: %s, erasependingempty: %s)\n",
- c->nr_erasing_blocks, list_empty(&c->erasable_list)?"yes":"no",
- list_empty(&c->erasing_list)?"yes":"no", list_empty(&c->erase_pending_list)?"yes":"no"));
- if (!list_empty(&c->erase_pending_list)) {
- D1(printk(KERN_DEBUG "Triggering pending erases\n"));
- jffs2_erase_pending_trigger(c);
- }
+
spin_unlock(&c->erase_completion_lock);
- schedule();
- remove_wait_queue(&c->erase_wait, &wait);
+ /* Don't wait for it; just erase one right now */
+ jffs2_erase_pending_blocks(c, 1);
spin_lock(&c->erase_completion_lock);
- if (signal_pending(current)) {
- return -EINTR;
- }
-#endif
+
/* An erase may have failed, decreasing the
amount of free space available. So we must
restart from the beginning */
More information about the linux-mtd-cvs
mailing list