diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-05-22 10:23:10 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-05-22 10:23:10 -0400 |
commit | fcb7578719529898aef9edce8e409e457a1c2d15 (patch) | |
tree | 58022b22d175b69e4b267f2f19ab26d93f7d4910 /fs/jffs2/scan.c | |
parent | a1b563d652b54647ffacb2d6edf7859d3e97a723 (diff) |
[JFFS2] Extend jffs2_link_node_ref() to link into per-inode list too.
Let's avoid the potential for forgetting to set ref->next_in_ino, by doing
it within jffs2_link_node_ref() instead.
This highlights the ugliness of what we're currently doing with
xattr_datum and xattr_ref structures -- we should find a nicer way of
dealing with that.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/scan.c')
-rw-r--r-- | fs/jffs2/scan.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index cffafec01e48..6fce703c0543 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c | |||
@@ -361,9 +361,9 @@ static int jffs2_scan_xattr_node(struct jffs2_sb_info *c, struct jffs2_erasebloc | |||
361 | xd->node = raw; | 361 | xd->node = raw; |
362 | 362 | ||
363 | raw->flash_offset = ofs | REF_PRISTINE; | 363 | raw->flash_offset = ofs | REF_PRISTINE; |
364 | raw->next_in_ino = (void *)xd; | ||
365 | 364 | ||
366 | jffs2_link_node_ref(c, jeb, raw, totlen); | 365 | jffs2_link_node_ref(c, jeb, raw, totlen, NULL); |
366 | /* FIXME */ raw->next_in_ino = (void *)xd; | ||
367 | 367 | ||
368 | if (jffs2_sum_active()) | 368 | if (jffs2_sum_active()) |
369 | jffs2_sum_add_xattr_mem(s, rx, ofs - jeb->offset); | 369 | jffs2_sum_add_xattr_mem(s, rx, ofs - jeb->offset); |
@@ -425,9 +425,9 @@ static int jffs2_scan_xref_node(struct jffs2_sb_info *c, struct jffs2_eraseblock | |||
425 | c->xref_temp = ref; | 425 | c->xref_temp = ref; |
426 | 426 | ||
427 | raw->flash_offset = ofs | REF_PRISTINE; | 427 | raw->flash_offset = ofs | REF_PRISTINE; |
428 | raw->next_in_ino = (void *)ref; | ||
429 | 428 | ||
430 | jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(rr->totlen))); | 429 | jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(rr->totlen)), NULL); |
430 | /* FIXME */ raw->next_in_ino = (void *)ref; | ||
431 | 431 | ||
432 | if (jffs2_sum_active()) | 432 | if (jffs2_sum_active()) |
433 | jffs2_sum_add_xref_mem(s, rr, ofs - jeb->offset); | 433 | jffs2_sum_add_xref_mem(s, rr, ofs - jeb->offset); |
@@ -844,10 +844,9 @@ scan_more: | |||
844 | printk(KERN_NOTICE "Failed to allocate node ref for clean marker\n"); | 844 | printk(KERN_NOTICE "Failed to allocate node ref for clean marker\n"); |
845 | return -ENOMEM; | 845 | return -ENOMEM; |
846 | } | 846 | } |
847 | marker_ref->next_in_ino = NULL; | ||
848 | marker_ref->flash_offset = ofs | REF_NORMAL; | 847 | marker_ref->flash_offset = ofs | REF_NORMAL; |
849 | 848 | ||
850 | jffs2_link_node_ref(c, jeb, marker_ref, c->cleanmarker_size); | 849 | jffs2_link_node_ref(c, jeb, marker_ref, c->cleanmarker_size, NULL); |
851 | 850 | ||
852 | ofs += PAD(c->cleanmarker_size); | 851 | ofs += PAD(c->cleanmarker_size); |
853 | } | 852 | } |
@@ -892,8 +891,7 @@ scan_more: | |||
892 | if (!ref) | 891 | if (!ref) |
893 | return -ENOMEM; | 892 | return -ENOMEM; |
894 | ref->flash_offset = ofs | REF_PRISTINE; | 893 | ref->flash_offset = ofs | REF_PRISTINE; |
895 | ref->next_in_ino = 0; | 894 | jffs2_link_node_ref(c, jeb, ref, PAD(je32_to_cpu(node->totlen)), NULL); |
896 | jffs2_link_node_ref(c, jeb, ref, PAD(je32_to_cpu(node->totlen))); | ||
897 | 895 | ||
898 | /* We can't summarise nodes we don't grok */ | 896 | /* We can't summarise nodes we don't grok */ |
899 | jffs2_sum_disable_collecting(s); | 897 | jffs2_sum_disable_collecting(s); |
@@ -1004,10 +1002,7 @@ static int jffs2_scan_inode_node(struct jffs2_sb_info *c, struct jffs2_erasebloc | |||
1004 | 1002 | ||
1005 | raw->flash_offset = ofs | REF_UNCHECKED; | 1003 | raw->flash_offset = ofs | REF_UNCHECKED; |
1006 | 1004 | ||
1007 | raw->next_in_ino = ic->nodes; | 1005 | jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(ri->totlen)), ic); |
1008 | ic->nodes = raw; | ||
1009 | |||
1010 | jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(ri->totlen))); | ||
1011 | 1006 | ||
1012 | D1(printk(KERN_DEBUG "Node is ino #%u, version %d. Range 0x%x-0x%x\n", | 1007 | D1(printk(KERN_DEBUG "Node is ino #%u, version %d. Range 0x%x-0x%x\n", |
1013 | je32_to_cpu(ri->ino), je32_to_cpu(ri->version), | 1008 | je32_to_cpu(ri->ino), je32_to_cpu(ri->version), |
@@ -1082,10 +1077,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo | |||
1082 | } | 1077 | } |
1083 | 1078 | ||
1084 | raw->flash_offset = ofs | REF_PRISTINE; | 1079 | raw->flash_offset = ofs | REF_PRISTINE; |
1085 | raw->next_in_ino = ic->nodes; | 1080 | jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(rd->totlen)), ic); |
1086 | ic->nodes = raw; | ||
1087 | |||
1088 | jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(rd->totlen))); | ||
1089 | 1081 | ||
1090 | fd->raw = raw; | 1082 | fd->raw = raw; |
1091 | fd->next = NULL; | 1083 | fd->next = NULL; |