aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-08-08 05:25:33 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-08-30 03:19:07 -0400
commitab87118d717467cbcd9648692c2a9708d55193bc (patch)
treed4e28ead7b0192942bd9f5665ff31fc57a572e1e /fs/ubifs
parent44ec83b8bd05d323998031f141c310127721acae (diff)
UBIFS: do not use key type in list_sort
In comparison function for 'list_sort()' we use key type to distinguish between node types. However, we have a bit simper way to detect node type - 'snod->type'. This more logical to use, comparing to decoding key types. Also allows to get rid of 2 local variables. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/gc.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
index 9dbbc5c88940..27815bb91125 100644
--- a/fs/ubifs/gc.c
+++ b/fs/ubifs/gc.c
@@ -157,7 +157,6 @@ int data_nodes_cmp(void *priv, struct list_head *a, struct list_head *b)
157 */ 157 */
158int nondata_nodes_cmp(void *priv, struct list_head *a, struct list_head *b) 158int nondata_nodes_cmp(void *priv, struct list_head *a, struct list_head *b)
159{ 159{
160 int typea, typeb;
161 ino_t inuma, inumb; 160 ino_t inuma, inumb;
162 struct ubifs_info *c = priv; 161 struct ubifs_info *c = priv;
163 struct ubifs_scan_node *sa, *sb; 162 struct ubifs_scan_node *sa, *sb;
@@ -165,21 +164,22 @@ int nondata_nodes_cmp(void *priv, struct list_head *a, struct list_head *b)
165 cond_resched(); 164 cond_resched();
166 sa = list_entry(a, struct ubifs_scan_node, list); 165 sa = list_entry(a, struct ubifs_scan_node, list);
167 sb = list_entry(b, struct ubifs_scan_node, list); 166 sb = list_entry(b, struct ubifs_scan_node, list);
168 typea = key_type(c, &sa->key); 167 ubifs_assert(sa->type != UBIFS_DATA_NODE &&
169 typeb = key_type(c, &sb->key); 168 sb->type != UBIFS_DATA_NODE);
170 ubifs_assert(typea != UBIFS_DATA_KEY && typeb != UBIFS_DATA_KEY);
171 169
172 /* Inodes go before directory entries */ 170 /* Inodes go before directory entries */
173 if (typea == UBIFS_INO_KEY) { 171 if (sa->type == UBIFS_INO_NODE) {
174 if (typeb == UBIFS_INO_KEY) 172 if (sb->type == UBIFS_INO_NODE)
175 return sb->len - sa->len; 173 return sb->len - sa->len;
176 return -1; 174 return -1;
177 } 175 }
178 if (typeb == UBIFS_INO_KEY) 176 if (sb->type == UBIFS_INO_NODE)
179 return 1; 177 return 1;
180 178
181 ubifs_assert(typea == UBIFS_DENT_KEY || typea == UBIFS_XENT_KEY); 179 ubifs_assert(sa->type == UBIFS_DENT_NODE ||
182 ubifs_assert(typeb == UBIFS_DENT_KEY || typeb == UBIFS_XENT_KEY); 180 sa->type == UBIFS_XENT_NODE);
181 ubifs_assert(sb->type == UBIFS_DENT_NODE ||
182 sb->type == UBIFS_XENT_NODE);
183 inuma = key_inum(c, &sa->key); 183 inuma = key_inum(c, &sa->key);
184 inumb = key_inum(c, &sb->key); 184 inumb = key_inum(c, &sb->key);
185 185