aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2008-04-23 09:15:24 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2008-04-23 09:15:24 -0400
commite2bc322bf05936ec7160d62bc3fd45cbf4aa405a (patch)
treeea7beb60c2fe6f35df9e6e51895812a9c254ad89 /fs/jffs2
parent697fa9721cbc54ce1604dae09d1be6bb918567f6 (diff)
[JFFS2] Add erase_checking_list to hold blocks being marked.
Just to keep the debug code happy when it's adding all the blocks up. Otherwise, they disappear for a while while the locks are dropped to check them and write the cleanmarker. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/build.c1
-rw-r--r--fs/jffs2/debug.c19
-rw-r--r--fs/jffs2/erase.c8
-rw-r--r--fs/jffs2/jffs2_fs_sb.h1
4 files changed, 25 insertions, 4 deletions
diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c
index 722a6b682951..d58f845ccb85 100644
--- a/fs/jffs2/build.c
+++ b/fs/jffs2/build.c
@@ -345,6 +345,7 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c)
345 INIT_LIST_HEAD(&c->dirty_list); 345 INIT_LIST_HEAD(&c->dirty_list);
346 INIT_LIST_HEAD(&c->erasable_list); 346 INIT_LIST_HEAD(&c->erasable_list);
347 INIT_LIST_HEAD(&c->erasing_list); 347 INIT_LIST_HEAD(&c->erasing_list);
348 INIT_LIST_HEAD(&c->erase_checking_list);
348 INIT_LIST_HEAD(&c->erase_pending_list); 349 INIT_LIST_HEAD(&c->erase_pending_list);
349 INIT_LIST_HEAD(&c->erasable_pending_wbuf_list); 350 INIT_LIST_HEAD(&c->erasable_pending_wbuf_list);
350 INIT_LIST_HEAD(&c->erase_complete_list); 351 INIT_LIST_HEAD(&c->erase_complete_list);
diff --git a/fs/jffs2/debug.c b/fs/jffs2/debug.c
index e198468a8c68..5544d31c066b 100644
--- a/fs/jffs2/debug.c
+++ b/fs/jffs2/debug.c
@@ -246,6 +246,10 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
246 nr_counted++; 246 nr_counted++;
247 erasing += c->sector_size; 247 erasing += c->sector_size;
248 } 248 }
249 list_for_each_entry(jeb, &c->erase_checking_list, list) {
250 nr_counted++;
251 erasing += c->sector_size;
252 }
249 list_for_each_entry(jeb, &c->erase_complete_list, list) { 253 list_for_each_entry(jeb, &c->erase_complete_list, list) {
250 nr_counted++; 254 nr_counted++;
251 erasing += c->sector_size; 255 erasing += c->sector_size;
@@ -582,6 +586,21 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
582 } 586 }
583 } 587 }
584 } 588 }
589 if (list_empty(&c->erase_checking_list)) {
590 printk(JFFS2_DBG "erase_checking_list: empty\n");
591 } else {
592 struct list_head *this;
593
594 list_for_each(this, &c->erase_checking_list) {
595 struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
596
597 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
598 printk(JFFS2_DBG "erase_checking_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
599 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
600 jeb->unchecked_size, jeb->free_size);
601 }
602 }
603 }
585 604
586 if (list_empty(&c->erase_pending_list)) { 605 if (list_empty(&c->erase_pending_list)) {
587 printk(JFFS2_DBG "erase_pending_list: empty\n"); 606 printk(JFFS2_DBG "erase_pending_list: empty\n");
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index 5e2719cb6930..25a640e566d3 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -116,7 +116,7 @@ void jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count)
116 116
117 if (!list_empty(&c->erase_complete_list)) { 117 if (!list_empty(&c->erase_complete_list)) {
118 jeb = list_entry(c->erase_complete_list.next, struct jffs2_eraseblock, list); 118 jeb = list_entry(c->erase_complete_list.next, struct jffs2_eraseblock, list);
119 list_del(&jeb->list); 119 list_move(&jeb->list, &c->erase_checking_list);
120 spin_unlock(&c->erase_completion_lock); 120 spin_unlock(&c->erase_completion_lock);
121 mutex_unlock(&c->erase_free_sem); 121 mutex_unlock(&c->erase_free_sem);
122 jffs2_mark_erased_block(c, jeb); 122 jffs2_mark_erased_block(c, jeb);
@@ -465,7 +465,7 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
465 if (c->cleanmarker_size && !jffs2_cleanmarker_oob(c)) 465 if (c->cleanmarker_size && !jffs2_cleanmarker_oob(c))
466 jffs2_link_node_ref(c, jeb, jeb->offset | REF_NORMAL, c->cleanmarker_size, NULL); 466 jffs2_link_node_ref(c, jeb, jeb->offset | REF_NORMAL, c->cleanmarker_size, NULL);
467 467
468 list_add_tail(&jeb->list, &c->free_list); 468 list_move_tail(&jeb->list, &c->free_list);
469 c->nr_erasing_blocks--; 469 c->nr_erasing_blocks--;
470 c->nr_free_blocks++; 470 c->nr_free_blocks++;
471 471
@@ -482,7 +482,7 @@ filebad:
482 spin_lock(&c->erase_completion_lock); 482 spin_lock(&c->erase_completion_lock);
483 /* Stick it on a list (any list) so erase_failed can take it 483 /* Stick it on a list (any list) so erase_failed can take it
484 right off again. Silly, but shouldn't happen often. */ 484 right off again. Silly, but shouldn't happen often. */
485 list_add(&jeb->list, &c->erasing_list); 485 list_move(&jeb->list, &c->erasing_list);
486 spin_unlock(&c->erase_completion_lock); 486 spin_unlock(&c->erase_completion_lock);
487 mutex_unlock(&c->erase_free_sem); 487 mutex_unlock(&c->erase_free_sem);
488 jffs2_erase_failed(c, jeb, bad_offset); 488 jffs2_erase_failed(c, jeb, bad_offset);
@@ -493,7 +493,7 @@ refile:
493 jffs2_erase_pending_trigger(c); 493 jffs2_erase_pending_trigger(c);
494 mutex_lock(&c->erase_free_sem); 494 mutex_lock(&c->erase_free_sem);
495 spin_lock(&c->erase_completion_lock); 495 spin_lock(&c->erase_completion_lock);
496 list_add(&jeb->list, &c->erase_complete_list); 496 list_move(&jeb->list, &c->erase_complete_list);
497 spin_unlock(&c->erase_completion_lock); 497 spin_unlock(&c->erase_completion_lock);
498 mutex_unlock(&c->erase_free_sem); 498 mutex_unlock(&c->erase_free_sem);
499 return; 499 return;
diff --git a/fs/jffs2/jffs2_fs_sb.h b/fs/jffs2/jffs2_fs_sb.h
index d9c4b27575e8..85ef6dbb1be7 100644
--- a/fs/jffs2/jffs2_fs_sb.h
+++ b/fs/jffs2/jffs2_fs_sb.h
@@ -87,6 +87,7 @@ struct jffs2_sb_info {
87 struct list_head erasable_list; /* Blocks which are completely dirty, and need erasing */ 87 struct list_head erasable_list; /* Blocks which are completely dirty, and need erasing */
88 struct list_head erasable_pending_wbuf_list; /* Blocks which need erasing but only after the current wbuf is flushed */ 88 struct list_head erasable_pending_wbuf_list; /* Blocks which need erasing but only after the current wbuf is flushed */
89 struct list_head erasing_list; /* Blocks which are currently erasing */ 89 struct list_head erasing_list; /* Blocks which are currently erasing */
90 struct list_head erase_checking_list; /* Blocks which are being checked and marked */
90 struct list_head erase_pending_list; /* Blocks which need erasing now */ 91 struct list_head erase_pending_list; /* Blocks which need erasing now */
91 struct list_head erase_complete_list; /* Blocks which are erased and need the clean marker written to them */ 92 struct list_head erase_complete_list; /* Blocks which are erased and need the clean marker written to them */
92 struct list_head free_list; /* Blocks which are free and ready to be used */ 93 struct list_head free_list; /* Blocks which are free and ready to be used */