vserver 1.9.5.x5
[linux-2.6.git] / fs / jffs2 / nodelist.h
index cea0c13..bb49491 100644 (file)
@@ -3,11 +3,11 @@
  *
  * Copyright (C) 2001-2003 Red Hat, Inc.
  *
- * Created by David Woodhouse <dwmw2@redhat.com>
+ * Created by David Woodhouse <dwmw2@infradead.org>
  *
  * For licensing information, see the file 'LICENCE' in this directory.
  *
- * $Id: nodelist.h,v 1.119 2004/05/26 12:28:12 gleixner Exp $
+ * $Id: nodelist.h,v 1.126 2004/11/19 15:06:29 dedekind Exp $
  *
  */
 
@@ -107,16 +107,6 @@ struct jffs2_raw_node_ref
 #define ref_obsolete(ref)      (((ref)->flash_offset & 3) == REF_OBSOLETE)
 #define mark_ref_normal(ref)    do { (ref)->flash_offset = ref_offset(ref) | REF_NORMAL; } while(0)
 
-/* 
-   Used for keeping track of deletion nodes &c, which can only be marked
-   as obsolete when the node which they mark as deleted has actually been 
-   removed from the flash.
-*/
-struct jffs2_raw_node_ref_list {
-       struct jffs2_raw_node_ref *rew;
-       struct jffs2_raw_node_ref_list *next;
-};
-
 /* For each inode in the filesystem, we need to keep a record of
    nlink, because it would be a PITA to scan the whole directory tree
    at read_inode() time to calculate it, and to keep sufficient information
@@ -148,13 +138,6 @@ struct jffs2_inode_cache {
 
 #define INOCACHE_HASHSIZE 128
 
-struct jffs2_scan_info {
-       struct jffs2_full_dirent *dents;
-       struct jffs2_tmp_dnode_info *tmpnodes;
-       /* Latest i_size info */
-       uint32_t version;
-       uint32_t isize;
-};
 /*
   Larger representation of a raw node, kept in-core only when the 
   struct inode for this particular ino is instantiated.
@@ -163,12 +146,11 @@ struct jffs2_scan_info {
 struct jffs2_full_dnode
 {
        struct jffs2_raw_node_ref *raw;
-       uint32_t ofs; /* Don't really need this, but optimisation */
+       uint32_t ofs; /* The offset to which the data of this node belongs */
        uint32_t size;
        uint32_t frags; /* Number of fragments which currently refer
                        to this node. When this reaches zero, 
-                       the node is obsolete.
-                    */
+                       the node is obsolete.  */
 };
 
 /* 
@@ -193,6 +175,7 @@ struct jffs2_full_dirent
        unsigned char type;
        unsigned char name[0];
 };
+
 /*
   Fragments - used to build a map of which raw node to obtain 
   data from for each part of the ino
@@ -202,7 +185,7 @@ struct jffs2_node_frag
        struct rb_node rb;
        struct jffs2_full_dnode *node; /* NULL for holes */
        uint32_t size;
-       uint32_t ofs; /* Don't really need this, but optimisation */
+       uint32_t ofs; /* The offset to which this fragment belongs */
 };
 
 struct jffs2_eraseblock
@@ -221,14 +204,6 @@ struct jffs2_eraseblock
        struct jffs2_raw_node_ref *last_node;
 
        struct jffs2_raw_node_ref *gc_node;     /* Next node to be garbage collected */
-
-       /* For deletia. When a dirent node in this eraseblock is
-          deleted by a node elsewhere, that other node can only 
-          be marked as obsolete when this block is actually erased.
-          So we keep a list of the nodes to mark as obsolete when
-          the erase is completed.
-       */
-       // MAYBE        struct jffs2_raw_node_ref_list *deletia;
 };
 
 #define ACCT_SANITY_CHECK(c, jeb) do { \
@@ -281,9 +256,14 @@ static inline void paranoia_failed_dump(struct jffs2_eraseblock *jeb)
                        else if (!ref_obsolete(ref2)) \
                                my_used_size += ref_totlen(c, jeb, ref2); \
                        if (unlikely((!ref2->next_phys) != (ref2 == jeb->last_node))) { \
-                               printk("ref for node at %p (phys %08x) has next_phys->%p (%08x), last_node->%p (phys %08x)\n", \
-                                      ref2, ref_offset(ref2), ref2->next_phys, ref_offset(ref2->next_phys), \
-                                      jeb->last_node, ref_offset(jeb->last_node)); \
+                                if (!ref2->next_phys) \
+                                      printk("ref for node at %p (phys %08x) has next_phys->%p (----), last_node->%p (phys %08x)\n", \
+                                            ref2, ref_offset(ref2), ref2->next_phys, \
+                                            jeb->last_node, ref_offset(jeb->last_node)); \
+                                else \
+                                       printk("ref for node at %p (phys %08x) has next_phys->%p (%08x), last_node->%p (phys %08x)\n", \
+                                            ref2, ref_offset(ref2), ref2->next_phys, ref_offset(ref2->next_phys), \
+                                            jeb->last_node, ref_offset(jeb->last_node)); \
                                paranoia_failed_dump(jeb); \
                                BUG(); \
                        } \
@@ -391,9 +371,9 @@ static inline struct jffs2_node_frag *frag_first(struct rb_root *root)
 #define frag_erase(frag, list) rb_erase(&frag->rb, list);
 
 /* nodelist.c */
-D1(void jffs2_print_frag_list(struct jffs2_inode_info *f));
+D2(void jffs2_print_frag_list(struct jffs2_inode_info *f));
 void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new, struct jffs2_full_dirent **list);
-int jffs2_get_inode_nodes(struct jffs2_sb_info *c, ino_t ino, struct jffs2_inode_info *f,
+int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
                          struct jffs2_tmp_dnode_info **tnp, struct jffs2_full_dirent **fdp,
                          uint32_t *highest_version, uint32_t *latest_mctime,
                          uint32_t *mctime_ver);