aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2006-05-22 11:32:05 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2006-05-22 11:32:05 -0400
commit987d47b71a85bd83dc40c870abee3b64f2002163 (patch)
treeecb840640cb1f7309b26d2c9a332bee5d0db6df9 /fs/jffs2
parent0eac940b8a087576c66ecf8e0f294f2ceb3b607b (diff)
[JFFS2] Put list of nodes in common part of ic/x_ref/x_datum structure
We'll be using a proper list of nodes in the jffs2_xattr_datum and jffs2_xattr_ref structures, because the existing code to overwrite them is just broken. Put it in the common part at the front of the structure which is shared with the jffs2_inode_cache, so that the jffs2_link_node_ref() function can do the right thing. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/nodelist.h44
-rw-r--r--fs/jffs2/xattr.h14
2 files changed, 34 insertions, 24 deletions
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h
index ee5aedcffc12..1e1c39da6da4 100644
--- a/fs/jffs2/nodelist.h
+++ b/fs/jffs2/nodelist.h
@@ -77,9 +77,9 @@
77struct jffs2_raw_node_ref 77struct jffs2_raw_node_ref
78{ 78{
79 struct jffs2_raw_node_ref *next_in_ino; /* Points to the next raw_node_ref 79 struct jffs2_raw_node_ref *next_in_ino; /* Points to the next raw_node_ref
80 for this inode. 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 for this inode instead. The inode_cache will have NULL in the first 81 xattr_ref or xattr_datum instead. The common part of those structures
82 word so you know when you've got there :) */ 82 has NULL in the first word. See jffs2_raw_ref_to_ic() below */
83 struct jffs2_raw_node_ref *next_phys; 83 struct jffs2_raw_node_ref *next_phys;
84 uint32_t flash_offset; 84 uint32_t flash_offset;
85#define TEST_TOTLEN 85#define TEST_TOTLEN
@@ -88,6 +88,18 @@ struct jffs2_raw_node_ref
88#endif 88#endif
89}; 89};
90 90
91static inline struct jffs2_inode_cache *jffs2_raw_ref_to_ic(struct jffs2_raw_node_ref *raw)
92{
93 while(raw->next_in_ino) {
94 raw = raw->next_in_ino;
95 }
96
97 /* NB. This can be a jffs2_xattr_datum or jffs2_xattr_ref and
98 not actually a jffs2_inode_cache. Check ->class */
99 return ((struct jffs2_inode_cache *)raw);
100}
101
102
91 /* flash_offset & 3 always has to be zero, because nodes are 103 /* flash_offset & 3 always has to be zero, because nodes are
92 always aligned at 4 bytes. So we have a couple of extra bits 104 always aligned at 4 bytes. So we have a couple of extra bits
93 to play with, which indicate the node's status; see below: */ 105 to play with, which indicate the node's status; see below: */
@@ -113,20 +125,27 @@ struct jffs2_raw_node_ref
113 a pointer to the first physical node which is part of this inode, too. 125 a pointer to the first physical node which is part of this inode, too.
114*/ 126*/
115struct jffs2_inode_cache { 127struct jffs2_inode_cache {
128 /* First part of structure is shared with other objects which
129 can terminate the raw node refs' next_in_ino list -- which
130 currently struct jffs2_xattr_datum and struct jffs2_xattr_ref. */
131
116 struct jffs2_full_dirent *scan_dents; /* Used during scan to hold 132 struct jffs2_full_dirent *scan_dents; /* Used during scan to hold
117 temporary lists of dirents, and later must be set to 133 temporary lists of dirents, and later must be set to
118 NULL to mark the end of the raw_node_ref->next_in_ino 134 NULL to mark the end of the raw_node_ref->next_in_ino
119 chain. */ 135 chain. */
120 u8 class; /* It's used for identification */
121 u8 flags;
122 uint16_t state;
123 struct jffs2_inode_cache *next;
124 struct jffs2_raw_node_ref *nodes; 136 struct jffs2_raw_node_ref *nodes;
137 uint8_t class; /* It's used for identification */
138
139 /* end of shared structure */
140
141 uint8_t flags;
142 uint16_t state;
125 uint32_t ino; 143 uint32_t ino;
126 int nlink; 144 struct jffs2_inode_cache *next;
127#ifdef CONFIG_JFFS2_FS_XATTR 145#ifdef CONFIG_JFFS2_FS_XATTR
128 struct jffs2_xattr_ref *xref; 146 struct jffs2_xattr_ref *xref;
129#endif 147#endif
148 int nlink;
130}; 149};
131 150
132/* Inode states for 'state' above. We need the 'GC' state to prevent 151/* Inode states for 'state' above. We need the 'GC' state to prevent
@@ -250,15 +269,6 @@ static inline int jffs2_encode_dev(union jffs2_device_node *jdev, dev_t rdev)
250 } 269 }
251} 270}
252 271
253static inline struct jffs2_inode_cache *jffs2_raw_ref_to_ic(struct jffs2_raw_node_ref *raw)
254{
255 while(raw->next_in_ino) {
256 raw = raw->next_in_ino;
257 }
258
259 return ((struct jffs2_inode_cache *)raw);
260}
261
262static inline struct jffs2_node_frag *frag_first(struct rb_root *root) 272static inline struct jffs2_node_frag *frag_first(struct rb_root *root)
263{ 273{
264 struct rb_node *node = root->rb_node; 274 struct rb_node *node = root->rb_node;
diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h
index e2aa2394ab64..2c199856c582 100644
--- a/fs/jffs2/xattr.h
+++ b/fs/jffs2/xattr.h
@@ -20,11 +20,11 @@
20struct jffs2_xattr_datum 20struct jffs2_xattr_datum
21{ 21{
22 void *always_null; 22 void *always_null;
23 u8 class;
24 u8 flags;
25 u16 xprefix; /* see JFFS2_XATTR_PREFIX_* */
26
27 struct jffs2_raw_node_ref *node; 23 struct jffs2_raw_node_ref *node;
24 uint8_t class;
25 uint8_t flags;
26 uint16_t xprefix; /* see JFFS2_XATTR_PREFIX_* */
27
28 struct list_head xindex; /* chained from c->xattrindex[n] */ 28 struct list_head xindex; /* chained from c->xattrindex[n] */
29 uint32_t refcnt; /* # of xattr_ref refers this */ 29 uint32_t refcnt; /* # of xattr_ref refers this */
30 uint32_t xid; 30 uint32_t xid;
@@ -42,11 +42,11 @@ struct jffs2_inode_cache;
42struct jffs2_xattr_ref 42struct jffs2_xattr_ref
43{ 43{
44 void *always_null; 44 void *always_null;
45 u8 class; 45 struct jffs2_raw_node_ref *node;
46 u8 flags; /* Currently unused */ 46 uint8_t class;
47 uint8_t flags; /* Currently unused */
47 u16 unused; 48 u16 unused;
48 49
49 struct jffs2_raw_node_ref *node;
50 union { 50 union {
51 struct jffs2_inode_cache *ic; /* reference to jffs2_inode_cache */ 51 struct jffs2_inode_cache *ic; /* reference to jffs2_inode_cache */
52 uint32_t ino; /* only used in scanning/building */ 52 uint32_t ino; /* only used in scanning/building */