[JFFS2] Extend jffs2_link_node_ref() to link into per-inode list too.
authorDavid Woodhouse <dwmw2@infradead.org>
Mon, 22 May 2006 14:23:10 +0000 (15:23 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Mon, 22 May 2006 14:23:10 +0000 (15:23 +0100)
Let's avoid the potential for forgetting to set ref->next_in_ino, by doing
it within jffs2_link_node_ref() instead.

This highlights the ugliness of what we're currently doing with
xattr_datum and xattr_ref structures -- we should find a nicer way of
dealing with that.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
fs/jffs2/erase.c
fs/jffs2/gc.c
fs/jffs2/nodelist.c
fs/jffs2/nodelist.h
fs/jffs2/nodemgmt.c
fs/jffs2/scan.c
fs/jffs2/summary.c
fs/jffs2/wbuf.c
fs/jffs2/write.c
fs/jffs2/xattr.c

index f677d6950fd40eeea43f70f6bd19a51a2115ddd7..0fc19a2fb5d91ae8e3710c09e3f9e9dc869588cf 100644 (file)
@@ -410,10 +410,9 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
                /* Everything else got zeroed before the erase */
                jeb->free_size = c->sector_size;
 
-               marker_ref->next_in_ino = NULL;
                marker_ref->flash_offset = jeb->offset | REF_NORMAL;
 
-               jffs2_link_node_ref(c, jeb, marker_ref, c->cleanmarker_size);
+               jffs2_link_node_ref(c, jeb, marker_ref, c->cleanmarker_size, NULL);
        }
 
        spin_lock(&c->erase_completion_lock);
index 4773ba24304f77c1e8f8958771e4661091b7948f..153755bc1d536a891b0f204c0c3e9169bf986ba7 100644 (file)
@@ -634,11 +634,8 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
                printk(KERN_NOTICE "Write of %d bytes at 0x%08x failed. returned %d, retlen %zd\n",
                        rawlen, phys_ofs, ret, retlen);
                if (retlen) {
-                        /* Doesn't belong to any inode */
-                       nraw->next_in_ino = NULL;
-
                        nraw->flash_offset |= REF_OBSOLETE;
-                       jffs2_add_physical_node_ref(c, nraw, rawlen);
+                       jffs2_add_physical_node_ref(c, nraw, rawlen, NULL);
                        jffs2_mark_node_obsolete(c, nraw);
                } else {
                        printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", nraw->flash_offset);
@@ -678,18 +675,8 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
                goto out_node;
        }
        nraw->flash_offset |= REF_PRISTINE;
-       jffs2_add_physical_node_ref(c, nraw, rawlen);
+       jffs2_add_physical_node_ref(c, nraw, rawlen, ic);
 
-       if (ic) {
-               /* Link into per-inode list. This is safe because of the ic
-                  state being INO_STATE_GC. Note that if we're doing this
-                  for an inode which is in-core, the 'nraw' pointer is then
-                  going to be fetched from ic->nodes by our caller. */
-               spin_lock(&c->erase_completion_lock);
-               nraw->next_in_ino = ic->nodes;
-               ic->nodes = nraw;
-               spin_unlock(&c->erase_completion_lock);
-       }
        jffs2_mark_node_obsolete(c, raw);
        D1(printk(KERN_DEBUG "WHEEE! GC REF_PRISTINE node at 0x%08x succeeded\n", ref_offset(raw)));
 
index 7d563f938b1c52a820ebe98589f037180538af34..d25d4919ca979ddf400d8786cedfffba8bced305 100644 (file)
@@ -1048,7 +1048,8 @@ void jffs2_kill_fragtree(struct rb_root *root, struct jffs2_sb_info *c)
 }
 
 void jffs2_link_node_ref(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
-                        struct jffs2_raw_node_ref *ref, uint32_t len)
+                        struct jffs2_raw_node_ref *ref, uint32_t len,
+                        struct jffs2_inode_cache *ic)
 {
        if (!jeb->first_node)
                jeb->first_node = ref;
@@ -1065,6 +1066,13 @@ void jffs2_link_node_ref(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
        }
        jeb->last_node = ref;
 
+       if (ic) {
+               ref->next_in_ino = ic->nodes;
+               ic->nodes = ref;
+       } else {
+               ref->next_in_ino = NULL;
+       }
+
        switch(ref_flags(ref)) {
        case REF_UNCHECKED:
                c->unchecked_size += len;
@@ -1120,12 +1128,11 @@ int jffs2_scan_dirty_space(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb
 
                ref->flash_offset = jeb->offset + c->sector_size - jeb->free_size;
                ref->flash_offset |= REF_OBSOLETE;
-               ref->next_in_ino = 0;
 #ifdef TEST_TOTLEN
                ref->__totlen = size;
 #endif
 
-               jffs2_link_node_ref(c, jeb, ref, size);
+               jffs2_link_node_ref(c, jeb, ref, size, NULL);
        }
 
        return 0;
index 80d1fda2212b03365ea3fa2a31084ccb34b3e804..ee5aedcffc125b5758ab4760f65c6a74e20429aa 100644 (file)
@@ -307,7 +307,8 @@ int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_in
 void jffs2_truncate_fragtree (struct jffs2_sb_info *c, struct rb_root *list, uint32_t size);
 int jffs2_add_older_frag_to_fragtree(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_tmp_dnode_info *tn);
 void jffs2_link_node_ref(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
-                        struct jffs2_raw_node_ref *ref, uint32_t len);
+                        struct jffs2_raw_node_ref *ref, uint32_t len,
+                        struct jffs2_inode_cache *ic);
 extern uint32_t __jffs2_ref_totlen(struct jffs2_sb_info *c,
                                   struct jffs2_eraseblock *jeb,
                                   struct jffs2_raw_node_ref *ref);
@@ -318,7 +319,10 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs
                        uint32_t *len, int prio, uint32_t sumsize);
 int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs,
                        uint32_t *len, uint32_t sumsize);
-int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *new, uint32_t len);
+int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, 
+                               struct jffs2_raw_node_ref *new,
+                               uint32_t len,
+                               struct jffs2_inode_cache *ic);
 void jffs2_complete_reservation(struct jffs2_sb_info *c);
 void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *raw);
 
index 9a0f312cfcda446eaf4813ee950688b1bde97404..e10e58eab8e59f2366cd5bb8881b33222d8925a8 100644 (file)
@@ -381,7 +381,8 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uin
  *     Must be called with the alloc_sem held.
  */
 
-int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *new, uint32_t len)
+int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *new,
+                               uint32_t len, struct jffs2_inode_cache *ic)
 {
        struct jffs2_eraseblock *jeb;
 
@@ -403,7 +404,7 @@ int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_r
 #endif
        spin_lock(&c->erase_completion_lock);
 
-       jffs2_link_node_ref(c, jeb, new, len);
+       jffs2_link_node_ref(c, jeb, new, len, ic);
 
        if (!jeb->free_size && !jeb->dirty_size && !ISDIRTY(jeb->wasted_size)) {
                /* If it lives on the dirty_list, jffs2_reserve_space will put it there */
index cffafec01e48b682bcdc31c2e73c536a91e0c554..6fce703c05434b36a6dc0e197c019230e2699311 100644 (file)
@@ -361,9 +361,9 @@ static int jffs2_scan_xattr_node(struct jffs2_sb_info *c, struct jffs2_erasebloc
        xd->node = raw;
 
        raw->flash_offset = ofs | REF_PRISTINE;
-       raw->next_in_ino = (void *)xd;
 
-       jffs2_link_node_ref(c, jeb, raw, totlen);
+       jffs2_link_node_ref(c, jeb, raw, totlen, NULL);
+       /* FIXME */ raw->next_in_ino = (void *)xd;
 
        if (jffs2_sum_active())
                jffs2_sum_add_xattr_mem(s, rx, ofs - jeb->offset);
@@ -425,9 +425,9 @@ static int jffs2_scan_xref_node(struct jffs2_sb_info *c, struct jffs2_eraseblock
        c->xref_temp = ref;
 
        raw->flash_offset = ofs | REF_PRISTINE;
-       raw->next_in_ino = (void *)ref;
 
-       jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(rr->totlen)));
+       jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(rr->totlen)), NULL);
+       /* FIXME */ raw->next_in_ino = (void *)ref;
 
        if (jffs2_sum_active())
                jffs2_sum_add_xref_mem(s, rr, ofs - jeb->offset);
@@ -844,10 +844,9 @@ scan_more:
                                        printk(KERN_NOTICE "Failed to allocate node ref for clean marker\n");
                                        return -ENOMEM;
                                }
-                               marker_ref->next_in_ino = NULL;
                                marker_ref->flash_offset = ofs | REF_NORMAL;
 
-                               jffs2_link_node_ref(c, jeb, marker_ref, c->cleanmarker_size);
+                               jffs2_link_node_ref(c, jeb, marker_ref, c->cleanmarker_size, NULL);
 
                                ofs += PAD(c->cleanmarker_size);
                        }
@@ -892,8 +891,7 @@ scan_more:
                                if (!ref)
                                        return -ENOMEM;
                                ref->flash_offset = ofs | REF_PRISTINE;
-                               ref->next_in_ino = 0;
-                               jffs2_link_node_ref(c, jeb, ref, PAD(je32_to_cpu(node->totlen)));
+                               jffs2_link_node_ref(c, jeb, ref, PAD(je32_to_cpu(node->totlen)), NULL);
 
                                /* We can't summarise nodes we don't grok */
                                jffs2_sum_disable_collecting(s);
@@ -1004,10 +1002,7 @@ static int jffs2_scan_inode_node(struct jffs2_sb_info *c, struct jffs2_erasebloc
 
        raw->flash_offset = ofs | REF_UNCHECKED;
 
-       raw->next_in_ino = ic->nodes;
-       ic->nodes = raw;
-       
-       jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(ri->totlen)));
+       jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(ri->totlen)), ic);
 
        D1(printk(KERN_DEBUG "Node is ino #%u, version %d. Range 0x%x-0x%x\n",
                  je32_to_cpu(ri->ino), je32_to_cpu(ri->version),
@@ -1082,10 +1077,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
        }
 
        raw->flash_offset = ofs | REF_PRISTINE;
-       raw->next_in_ino = ic->nodes;
-       ic->nodes = raw;
-
-       jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(rd->totlen)));
+       jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(rd->totlen)), ic);
 
        fd->raw = raw;
        fd->next = NULL;
index 1451732e1fa7296bf5873ade122d8bbb8cd60d29..351ba9f8185ec6a5330b754a3d48815aac77a489 100644 (file)
@@ -430,10 +430,7 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
 
                                raw->flash_offset |= REF_UNCHECKED;
 
-                               raw->next_in_ino = ic->nodes;
-                               ic->nodes = raw;
-
-                               jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(spi->totlen)));
+                               jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(spi->totlen)), ic);
 
                                *pseudo_random += je32_to_cpu(spi->version);
 
@@ -473,10 +470,7 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
                                }
 
                                raw->flash_offset |= REF_PRISTINE;
-                               raw->next_in_ino = ic->nodes;
-                               ic->nodes = raw;
-
-                               jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(spd->totlen)));
+                               jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(spd->totlen)), ic);
 
                                fd->raw = raw;
                                fd->next = NULL;
@@ -525,9 +519,9 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
                                xd->node = raw;
 
                                raw->flash_offset |= REF_UNCHECKED;
-                               raw->next_in_ino = (void *)xd;
 
-                               jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(spx->totlen)));
+                               jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(spx->totlen)), NULL);
+                               /* FIXME */ raw->next_in_ino = (void *)xd;
 
                                *pseudo_random += je32_to_cpu(spx->xid);
                                sp += JFFS2_SUMMARY_XATTR_SIZE;
@@ -561,9 +555,9 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
                                c->xref_temp = ref;
 
                                raw->flash_offset |= REF_UNCHECKED;
-                               raw->next_in_ino = (void *)ref;
 
-                               jffs2_link_node_ref(c, jeb, raw, PAD(sizeof(struct jffs2_raw_xref)));
+                               jffs2_link_node_ref(c, jeb, raw, PAD(sizeof(struct jffs2_raw_xref)), NULL);
+                               /* FIXME */ raw->next_in_ino = (void *)ref;
 
                                *pseudo_random += raw->flash_offset;
                                sp += JFFS2_SUMMARY_XREF_SIZE;
@@ -664,9 +658,8 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb
                        }
 
                        marker_ref->flash_offset = jeb->offset | REF_NORMAL;
-                       marker_ref->next_in_ino = NULL;
 
-                       jffs2_link_node_ref(c, jeb, marker_ref, je32_to_cpu(summary->cln_mkr));
+                       jffs2_link_node_ref(c, jeb, marker_ref, je32_to_cpu(summary->cln_mkr), NULL);
                }
        }
 
@@ -686,10 +679,9 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb
                return -ENOMEM;
        }
 
-       cache_ref->next_in_ino = NULL;
        cache_ref->flash_offset |= REF_NORMAL;
 
-       jffs2_link_node_ref(c, jeb, cache_ref, sumsize);
+       jffs2_link_node_ref(c, jeb, cache_ref, sumsize, NULL);
 
        if (unlikely(jeb->free_size)) {
                JFFS2_WARNING("Free size 0x%x bytes in eraseblock @0x%08x with summary?\n",
@@ -849,9 +841,8 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock
 
                        ref->flash_offset = jeb->offset + c->sector_size - jeb->free_size;
                        ref->flash_offset |= REF_OBSOLETE;
-                       ref->next_in_ino = 0;
 
-                       jffs2_link_node_ref(c, jeb, ref, c->sector_size - jeb->free_size);
+                       jffs2_link_node_ref(c, jeb, ref, c->sector_size - jeb->free_size, NULL);
                }
 
                c->summary->sum_size = JFFS2_SUMMARY_NOSUM_SIZE;
@@ -909,11 +900,10 @@ int jffs2_sum_write_sumnode(struct jffs2_sb_info *c)
                return -ENOMEM;
        }
 
-       summary_ref->next_in_ino = NULL;
        summary_ref->flash_offset = (jeb->offset + c->sector_size - jeb->free_size) | REF_NORMAL;
 
        spin_lock(&c->erase_completion_lock);
-       jffs2_link_node_ref(c, jeb, summary_ref, infosize);
+       jffs2_link_node_ref(c, jeb, summary_ref, infosize, NULL);
 
        return 0;
 }
index 45e3573cf1078001e971361ce1b28cd44170862a..62f685faeba8407c4c64e3f31ef55075d0db6b7d 100644 (file)
@@ -312,9 +312,8 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
                                        return;
 
                                raw2->flash_offset = ofs | REF_OBSOLETE;
-                               raw2->next_in_ino = NULL;
 
-                               jffs2_add_physical_node_ref(c, raw2, ref_totlen(c, jeb, *first_raw));
+                               jffs2_add_physical_node_ref(c, raw2, ref_totlen(c, jeb, *first_raw), NULL);
                        }
                        return;
                }
@@ -507,11 +506,10 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad)
                        return -ENOMEM;
                ref->flash_offset = c->wbuf_ofs + c->wbuf_len;
                ref->flash_offset |= REF_OBSOLETE;
-               ref->next_in_ino = NULL;
 
                spin_lock(&c->erase_completion_lock);
 
-               jffs2_link_node_ref(c, jeb, ref, waste);
+               jffs2_link_node_ref(c, jeb, ref, waste, NULL);
                /* FIXME: that made it count as dirty. Convert to wasted */
                jeb->dirty_size -= waste;
                c->dirty_size -= waste;
index 4462541d11f8820b1d54a294316a82dc26e9b8e8..319a70f531f8fb72c84bc110d5676e84326cfe13 100644 (file)
@@ -122,16 +122,13 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
 
                /* Mark the space as dirtied */
                if (retlen) {
-                       /* Doesn't belong to any inode */
-                       raw->next_in_ino = NULL;
-
                        /* Don't change raw->size to match retlen. We may have
                           written the node header already, and only the data will
                           seem corrupted, in which case the scan would skip over
                           any node we write before the original intended end of
                           this node */
                        raw->flash_offset |= REF_OBSOLETE;
-                       jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*ri)+datalen));
+                       jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*ri)+datalen), NULL);
                        jffs2_mark_node_obsolete(c, raw);
                } else {
                        printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", raw->flash_offset);
@@ -189,13 +186,7 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
        } else {
                raw->flash_offset |= REF_NORMAL;
        }
-       jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*ri)+datalen));
-
-       /* Link into per-inode list */
-       spin_lock(&c->erase_completion_lock);
-       raw->next_in_ino = f->inocache->nodes;
-       f->inocache->nodes = raw;
-       spin_unlock(&c->erase_completion_lock);
+       jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*ri)+datalen), f->inocache);
 
        D1(printk(KERN_DEBUG "jffs2_write_dnode wrote node at 0x%08x(%d) with dsize 0x%x, csize 0x%x, node_crc 0x%08x, data_crc 0x%08x, totlen 0x%08x\n",
                  flash_ofs, ref_flags(raw), je32_to_cpu(ri->dsize),
@@ -275,9 +266,8 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
                               sizeof(*rd)+namelen, flash_ofs, ret, retlen);
                /* Mark the space as dirtied */
                if (retlen) {
-                       raw->next_in_ino = NULL;
                        raw->flash_offset |= REF_OBSOLETE;
-                       jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*rd)+namelen));
+                       jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*rd)+namelen), NULL);
                        jffs2_mark_node_obsolete(c, raw);
                } else {
                        printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", raw->flash_offset);
@@ -323,12 +313,7 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
        }
        /* Mark the space used */
        raw->flash_offset |= REF_PRISTINE;
-       jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*rd)+namelen));
-
-       spin_lock(&c->erase_completion_lock);
-       raw->next_in_ino = f->inocache->nodes;
-       f->inocache->nodes = raw;
-       spin_unlock(&c->erase_completion_lock);
+       jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*rd)+namelen), f->inocache);
 
        if (retried) {
                jffs2_dbg_acct_sanity_check(c,NULL);
index e16f8460ff049a3db7fac0f136e0c8152a7d5c5d..76d16614038168701aef520b9674353bcc14d16a 100644 (file)
@@ -322,7 +322,6 @@ static int save_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *x
        if (!raw)
                return -ENOMEM;
        raw->flash_offset = phys_ofs;
-       raw->next_in_ino = (void *)xd;
 
        /* Setup raw-xattr */
        rx.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
@@ -345,8 +344,7 @@ static int save_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *x
                rc = rc ? rc : -EIO;
                if (length) {
                        raw->flash_offset |= REF_OBSOLETE;
-                       raw->next_in_ino = NULL;
-                       jffs2_add_physical_node_ref(c, raw, PAD(totlen));
+                       jffs2_add_physical_node_ref(c, raw, PAD(totlen), NULL);
                        jffs2_mark_node_obsolete(c, raw);
                } else {
                        jffs2_free_raw_node_ref(raw);
@@ -356,7 +354,9 @@ static int save_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *x
 
        /* success */
        raw->flash_offset |= REF_PRISTINE;
-       jffs2_add_physical_node_ref(c, raw, PAD(totlen));
+       jffs2_add_physical_node_ref(c, raw, PAD(totlen), NULL);
+       /* FIXME */ raw->next_in_ino = (void *)xd;
+
        if (xd->node)
                delete_xattr_datum_node(c, xd);
        xd->node = raw;
@@ -566,7 +566,6 @@ static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref,
        if (!raw)
                return -ENOMEM;
        raw->flash_offset = phys_ofs;
-       raw->next_in_ino = (void *)ref;
 
        rr.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
        rr.nodetype = cpu_to_je16(JFFS2_NODETYPE_XREF);
@@ -584,8 +583,7 @@ static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref,
                ret = ret ? ret : -EIO;
                if (length) {
                        raw->flash_offset |= REF_OBSOLETE;
-                       raw->next_in_ino = NULL;
-                       jffs2_add_physical_node_ref(c, raw, PAD(sizeof(rr)));
+                       jffs2_add_physical_node_ref(c, raw, PAD(sizeof(rr)), NULL);
                        jffs2_mark_node_obsolete(c, raw);
                } else {
                        jffs2_free_raw_node_ref(raw);
@@ -594,7 +592,8 @@ static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref,
        }
        raw->flash_offset |= REF_PRISTINE;
 
-       jffs2_add_physical_node_ref(c, raw, PAD(sizeof(rr)));
+       jffs2_add_physical_node_ref(c, raw, PAD(sizeof(rr)), NULL);
+       /* FIXME */ raw->next_in_ino = (void *)ref;
        if (ref->node)
                delete_xattr_ref_node(c, ref);
        ref->node = raw;