JFFS2_DBG_SUMMARY("generating summary for 0x%08x.\n", jeb->offset); 
dbg_summary("generating summary for 0x%08x.\n", jeb->offset); 
static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs, uint32_t *len, uint32_t sumsize){	struct jffs2_eraseblock *jeb = c->nextblock;	uint32_t reserved_size; 			/* for summary information at the end of the jeb */	int ret; restart:	reserved_size = 0;	if (jffs2_sum_active() && (sumsize != JFFS2_SUMMARY_NOSUM_SIZE)) {							/* NOSUM_SIZE means not to generate summary */		if (jeb) {			reserved_size = PAD(sumsize + c->summary->sum_size + JFFS2_SUMMARY_FRAME_SIZE);			JFFS2_DBG_SUMMARY("minsize=%d , jeb->free=%d ,"						"summary->size=%d , sumsize=%d\n",						minsize, jeb->free_size,						c->summary->sum_size, sumsize);		}		/* Is there enough space for writing out the current node, or we have to		   write out summary information now, close this jeb and select new nextblock? */		if (jeb && (PAD(minsize) + PAD(c->summary->sum_size + sumsize +					JFFS2_SUMMARY_FRAME_SIZE) > jeb->free_size)) {			/* Has summary been disabled for this jeb? */			if (jffs2_sum_is_disabled(c->summary)) {				sumsize = JFFS2_SUMMARY_NOSUM_SIZE;				goto restart;			}			/* Writing out the collected summary information */			JFFS2_DBG_SUMMARY("generating summary for 0x%08x.\n", jeb->offset);			ret = jffs2_sum_write_sumnode(c);			if (ret)				return ret;			if (jffs2_sum_is_disabled(c->summary)) {				/* jffs2_write_sumnode() couldn't write out the summary information				   diabling summary for this jeb and free the collected information				 */				sumsize = JFFS2_SUMMARY_NOSUM_SIZE;				goto restart;			}			jffs2_close_nextblock(c, jeb);			jeb = NULL;			/* keep always valid value in reserved_size */			reserved_size = PAD(sumsize + c->summary->sum_size + JFFS2_SUMMARY_FRAME_SIZE);		}	} else {		if (jeb && minsize > jeb->free_size) {			/* Skip the end of this block and file it as having some dirty space */			/* If there's a pending write to it, flush now */			if (jffs2_wbuf_dirty(c)) {				spin_unlock(&c->erase_completion_lock);				D1(printk(KERN_DEBUG "jffs2_do_reserve_space: Flushing write buffer\n"));				jffs2_flush_wbuf_pad(c);				spin_lock(&c->erase_completion_lock);				jeb = c->nextblock;				goto restart;			}			c->wasted_size += jeb->free_size;			c->free_size -= jeb->free_size;			jeb->wasted_size += jeb->free_size;			jeb->free_size = 0;			jffs2_close_nextblock(c, jeb);			jeb = NULL;		}	}	if (!jeb) {		ret = jffs2_find_nextblock(c);		if (ret)			return ret;		jeb = c->nextblock;		if (jeb->free_size != c->sector_size - c->cleanmarker_size) {			printk(KERN_WARNING "Eep. Block 0x%08x taken from free_list had free_size of 0x%08x!!\n", jeb->offset, jeb->free_size);			goto restart;		}	}	/* OK, jeb (==c->nextblock) is now pointing at a block which definitely has	   enough space */	*ofs = jeb->offset + (c->sector_size - jeb->free_size);	*len = jeb->free_size - reserved_size;	if (c->cleanmarker_size && jeb->used_size == c->cleanmarker_size &&	    !jeb->first_node->next_in_ino) {		/* Only node in it beforehand was a CLEANMARKER node (we think). 		   So mark it obsolete now that there's going to be another node		   in the block. This will reduce used_size to zero but We've 		   already set c->nextblock so that jffs2_mark_node_obsolete()		   won't try to refile it to the dirty_list.		*/		spin_unlock(&c->erase_completion_lock);		jffs2_mark_node_obsolete(c, jeb->first_node);		spin_lock(&c->erase_completion_lock);	}	D1(printk(KERN_DEBUG "jffs2_do_reserve_space(): Giving 0x%x bytes at 0x%x\n", *len, *ofs));	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/733802d974e5af42acb7cd61b16c0ce6dd03b7ed/nodemgmt.c/buggy/fs/jffs2/nodemgmt.c