static int file_dirty(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb)
{
- int ret = jffs2_scan_dirty_space(c, jeb, jeb->free_size);
- if (ret)
+ int ret;
+
+ if ((ret = jffs2_prealloc_raw_node_refs(c, jeb, 1)))
+ return ret;
+ if ((ret = jffs2_scan_dirty_space(c, jeb, jeb->free_size)))
return ret;
/* Turned wasted size into dirty, since we apparently
think it's recoverable now. */
}
if (PAD(sizeof(struct jffs2_raw_xref)) != je32_to_cpu(rr->totlen)) {
- JFFS2_WARNING("node length mismatch at %#08x, read=%u, calc=%u\n",
+ JFFS2_WARNING("node length mismatch at %#08x, read=%u, calc=%zd\n",
ofs, je32_to_cpu(rr->totlen),
PAD(sizeof(struct jffs2_raw_xref)));
if ((err = jffs2_scan_dirty_space(c, jeb, je32_to_cpu(rr->totlen))))
if (!buf_size) {
/* XIP case. Just look, point at the summary if it's there */
- sm = (void *)buf + jeb->offset - sizeof(*sm);
+ sm = (void *)buf + c->sector_size - sizeof(*sm);
if (je32_to_cpu(sm->magic) == JFFS2_SUM_MAGIC) {
sumptr = buf + je32_to_cpu(sm->offset);
sumlen = c->sector_size - je32_to_cpu(sm->offset);
if (ofs) {
D1(printk(KERN_DEBUG "Free space at %08x ends at %08x\n", jeb->offset,
jeb->offset + ofs));
+ if ((err = jffs2_prealloc_raw_node_refs(c, jeb, 1)))
+ return err;
if ((err = jffs2_scan_dirty_space(c, jeb, ofs)))
return err;
}