237 D1(if (c->nextblock)
238 printk(KERN_DEBUG "Nextblock at %08x, used_size %08x, dirty_size %08x, wasted_size %08x, free_size %08x\n", c->nextblock->offset, c->nextblock->used_size, c->nextblock->dirty_size, c->nextblock->wasted_size, c->nextblock->free_size));
239
240 if (!jeb->used_size) {
241 mutex_unlock(&c->alloc_sem);
242 goto eraseit;
243 }
244
245 raw = jeb->gc_node;
246 gcblock_dirty = jeb->dirty_size;
247
248 while(ref_obsolete(raw)) {
249 D1(printk(KERN_DEBUG "Node at 0x%08x is obsolete... skipping\n", ref_offset(raw)));
250 raw = ref_next(raw);
251 if (unlikely(!raw)) {
252 printk(KERN_WARNING "eep. End of raw list while still supposedly nodes to GC\n");
253 printk(KERN_WARNING "erase block at 0x%08x. free_size 0x%08x, dirty_size 0x%08x, used_size 0x%08x\n",
254 jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size);
255 jeb->gc_node = raw;
256 spin_unlock(&c->erase_completion_lock);
257 mutex_unlock(&c->alloc_sem);
258 BUG();
259 }
260 }
261 jeb->gc_node = raw;
262
263 D1(printk(KERN_DEBUG "Going to garbage collect node at 0x%08x\n", ref_offset(raw)));
264
265 if (!raw->next_in_ino) {
266
267 spin_unlock(&c->erase_completion_lock);
268 if (ref_flags(raw) == REF_PRISTINE) {
269
270 jffs2_garbage_collect_pristine(c, NULL, raw);
271 } else {
272
273 jffs2_mark_node_obsolete(c, raw);
274 }
275 mutex_unlock(&c->alloc_sem);
276 goto eraseit_lock;
277 }