]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/jffs2/nodelist.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/perex/alsa
[linux-2.6-omap-h63xx.git] / fs / jffs2 / nodelist.c
index be38cc5c35cd97eb79728c8697c850df1454c101..4991c348f6ec36ee82f2525e2ae4c86aeed82bfb 100644 (file)
@@ -7,7 +7,7 @@
  *
  * For licensing information, see the file 'LICENCE' in this directory.
  *
- * $Id: nodelist.c,v 1.95 2005/07/05 21:03:07 dwmw2 Exp $
+ * $Id: nodelist.c,v 1.98 2005/07/10 15:15:32 dedekind Exp $
  *
  */
 
@@ -55,11 +55,11 @@ void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new
        });
 }
 
-/* Put a new tmp_dnode_info into the list, keeping the list in 
-   order of increasing version
-*/
-
-static void jffs2_add_tn_to_list(struct jffs2_tmp_dnode_info *tn, struct rb_root *list)
+/* 
+ * Put a new tmp_dnode_info into the temporaty RB-tree, keeping the list in 
+ * order of increasing version.
+ */
+static void jffs2_add_tn_to_tree(struct jffs2_tmp_dnode_info *tn, struct rb_root *list)
 {
        struct rb_node **p = &list->rb_node;
        struct rb_node * parent = NULL;
@@ -69,12 +69,11 @@ static void jffs2_add_tn_to_list(struct jffs2_tmp_dnode_info *tn, struct rb_root
                parent = *p;
                this = rb_entry(parent, struct jffs2_tmp_dnode_info, rb);
 
+               /* There may actually be a collision here, but it doesn't
+                  actually matter. As long as the two nodes with the same
+                  version are together, it's all fine. */
                if (tn->version < this->version)
                        p = &(*p)->rb_left;
-               else if (tn->version > this->version)
-                       p = &(*p)->rb_right;
-               else if (tn < this)
-                       p = &(*p)->rb_left;
                else
                        p = &(*p)->rb_right;
         }
@@ -421,7 +420,7 @@ int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
                        D1(printk(KERN_DEBUG "dnode @%08x: ver %u, offset %04x, dsize %04x\n",
                                  ref_offset(ref), je32_to_cpu(node.i.version),
                                  je32_to_cpu(node.i.offset), je32_to_cpu(node.i.dsize)));
-                       jffs2_add_tn_to_list(tn, &ret_tn);
+                       jffs2_add_tn_to_tree(tn, &ret_tn);
                        break;
 
                default: