]> err.no Git - linux-2.6/blobdiff - fs/jffs2/scan.c
[PATCH] epoll: use unlocked wqueue operations
[linux-2.6] / fs / jffs2 / scan.c
index 404ba6e485817e14da45c8fb193228efd1da381e..61618080b86f0a9bfe3202e39c8e452f13a21ec5 100644 (file)
@@ -67,8 +67,11 @@ static inline uint32_t EMPTY_SCAN_SIZE(uint32_t sector_size) {
 
 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. */
@@ -379,7 +382,7 @@ static int jffs2_scan_xref_node(struct jffs2_sb_info *c, struct jffs2_eraseblock
        }
 
        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))))
@@ -460,7 +463,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
              
                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);
@@ -559,6 +562,8 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
        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;
        }