diff options
Diffstat (limited to 'fs/jffs')
-rw-r--r-- | fs/jffs/intrep.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/fs/jffs/intrep.c b/fs/jffs/intrep.c index 456d7e6e29c2..27f199e94cfc 100644 --- a/fs/jffs/intrep.c +++ b/fs/jffs/intrep.c | |||
@@ -1701,12 +1701,10 @@ jffs_find_file(struct jffs_control *c, __u32 ino) | |||
1701 | { | 1701 | { |
1702 | struct jffs_file *f; | 1702 | struct jffs_file *f; |
1703 | int i = ino % c->hash_len; | 1703 | int i = ino % c->hash_len; |
1704 | struct list_head *tmp; | ||
1705 | 1704 | ||
1706 | D3(printk("jffs_find_file(): ino: %u\n", ino)); | 1705 | D3(printk("jffs_find_file(): ino: %u\n", ino)); |
1707 | 1706 | ||
1708 | for (tmp = c->hash[i].next; tmp != &c->hash[i]; tmp = tmp->next) { | 1707 | list_for_each_entry(f, &c->hash[i], hash) { |
1709 | f = list_entry(tmp, struct jffs_file, hash); | ||
1710 | if (ino != f->ino) | 1708 | if (ino != f->ino) |
1711 | continue; | 1709 | continue; |
1712 | D3(printk("jffs_find_file(): Found file with ino " | 1710 | D3(printk("jffs_find_file(): Found file with ino " |
@@ -2102,13 +2100,12 @@ jffs_foreach_file(struct jffs_control *c, int (*func)(struct jffs_file *)) | |||
2102 | int result = 0; | 2100 | int result = 0; |
2103 | 2101 | ||
2104 | for (pos = 0; pos < c->hash_len; pos++) { | 2102 | for (pos = 0; pos < c->hash_len; pos++) { |
2105 | struct list_head *p, *next; | 2103 | struct jffs_file *f, *next; |
2106 | for (p = c->hash[pos].next; p != &c->hash[pos]; p = next) { | 2104 | |
2107 | /* We need a reference to the next file in the | 2105 | /* We must do _safe, because 'func' might remove the |
2108 | list because `func' might remove the current | 2106 | current file 'f' from the list. */ |
2109 | file `f'. */ | 2107 | list_for_each_entry_safe(f, next, &c->hash[pos], hash) { |
2110 | next = p->next; | 2108 | r = func(f); |
2111 | r = func(list_entry(p, struct jffs_file, hash)); | ||
2112 | if (r < 0) | 2109 | if (r < 0) |
2113 | return r; | 2110 | return r; |
2114 | result += r; | 2111 | result += r; |
@@ -2613,9 +2610,8 @@ jffs_print_hash_table(struct jffs_control *c) | |||
2613 | 2610 | ||
2614 | printk("JFFS: Dumping the file system's hash table...\n"); | 2611 | printk("JFFS: Dumping the file system's hash table...\n"); |
2615 | for (i = 0; i < c->hash_len; i++) { | 2612 | for (i = 0; i < c->hash_len; i++) { |
2616 | struct list_head *p; | 2613 | struct jffs_file *f; |
2617 | for (p = c->hash[i].next; p != &c->hash[i]; p = p->next) { | 2614 | list_for_each_entry(f, &c->hash[i], hash) { |
2618 | struct jffs_file *f=list_entry(p,struct jffs_file,hash); | ||
2619 | printk("*** c->hash[%u]: \"%s\" " | 2615 | printk("*** c->hash[%u]: \"%s\" " |
2620 | "(ino: %u, pino: %u)\n", | 2616 | "(ino: %u, pino: %u)\n", |
2621 | i, (f->name ? f->name : ""), | 2617 | i, (f->name ? f->name : ""), |