aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/nodelist.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/nodelist.h')
-rw-r--r--fs/jffs2/nodelist.h31
1 files changed, 26 insertions, 5 deletions
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h
index 6c92dc46fe9e..7ad8ee043880 100644
--- a/fs/jffs2/nodelist.h
+++ b/fs/jffs2/nodelist.h
@@ -80,7 +80,6 @@ struct jffs2_raw_node_ref
80 for this object. If this _is_ the last, it points to the inode_cache, 80 for this object. If this _is_ the last, it points to the inode_cache,
81 xattr_ref or xattr_datum instead. The common part of those structures 81 xattr_ref or xattr_datum instead. The common part of those structures
82 has NULL in the first word. See jffs2_raw_ref_to_ic() below */ 82 has NULL in the first word. See jffs2_raw_ref_to_ic() below */
83 struct jffs2_raw_node_ref *next_phys;
84 uint32_t flash_offset; 83 uint32_t flash_offset;
85#define TEST_TOTLEN 84#define TEST_TOTLEN
86#ifdef TEST_TOTLEN 85#ifdef TEST_TOTLEN
@@ -88,7 +87,29 @@ struct jffs2_raw_node_ref
88#endif 87#endif
89}; 88};
90 89
91#define ref_next(r) ((r)->next_phys) 90#define REF_LINK_NODE ((int32_t)-1)
91#define REF_EMPTY_NODE ((int32_t)-2)
92
93/* Use blocks of about 256 bytes */
94#define REFS_PER_BLOCK ((255/sizeof(struct jffs2_raw_node_ref))-1)
95
96static inline struct jffs2_raw_node_ref *ref_next(struct jffs2_raw_node_ref *ref)
97{
98 ref++;
99
100 /* Link to another block of refs */
101 if (ref->flash_offset == REF_LINK_NODE) {
102 ref = ref->next_in_ino;
103 if (!ref)
104 return ref;
105 }
106
107 /* End of chain */
108 if (ref->flash_offset == REF_EMPTY_NODE)
109 return NULL;
110
111 return ref;
112}
92 113
93static inline struct jffs2_inode_cache *jffs2_raw_ref_to_ic(struct jffs2_raw_node_ref *raw) 114static inline struct jffs2_inode_cache *jffs2_raw_ref_to_ic(struct jffs2_raw_node_ref *raw)
94{ 115{
@@ -234,6 +255,7 @@ struct jffs2_eraseblock
234 uint32_t wasted_size; 255 uint32_t wasted_size;
235 uint32_t free_size; /* Note that sector_size - free_size 256 uint32_t free_size; /* Note that sector_size - free_size
236 is the address of the first free space */ 257 is the address of the first free space */
258 uint32_t allocated_refs;
237 struct jffs2_raw_node_ref *first_node; 259 struct jffs2_raw_node_ref *first_node;
238 struct jffs2_raw_node_ref *last_node; 260 struct jffs2_raw_node_ref *last_node;
239 261
@@ -378,10 +400,9 @@ struct jffs2_raw_inode *jffs2_alloc_raw_inode(void);
378void jffs2_free_raw_inode(struct jffs2_raw_inode *); 400void jffs2_free_raw_inode(struct jffs2_raw_inode *);
379struct jffs2_tmp_dnode_info *jffs2_alloc_tmp_dnode_info(void); 401struct jffs2_tmp_dnode_info *jffs2_alloc_tmp_dnode_info(void);
380void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *); 402void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *);
381int jffs2_prealloc_raw_node_refs(struct jffs2_sb_info *c, 403int jffs2_prealloc_raw_node_refs(struct jffs2_sb_info *c,
382 struct jffs2_eraseblock *jeb, int nr); 404 struct jffs2_eraseblock *jeb, int nr);
383struct jffs2_raw_node_ref *__jffs2_alloc_raw_node_ref(void); 405void jffs2_free_refblock(struct jffs2_raw_node_ref *);
384void __jffs2_free_raw_node_ref(struct jffs2_raw_node_ref *);
385struct jffs2_node_frag *jffs2_alloc_node_frag(void); 406struct jffs2_node_frag *jffs2_alloc_node_frag(void);
386void jffs2_free_node_frag(struct jffs2_node_frag *); 407void jffs2_free_node_frag(struct jffs2_node_frag *);
387struct jffs2_inode_cache *jffs2_alloc_inode_cache(void); 408struct jffs2_inode_cache *jffs2_alloc_inode_cache(void);