diff options
Diffstat (limited to 'fs/jffs2/summary.c')
-rw-r--r-- | fs/jffs2/summary.c | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c index 0b02fc79e4d1..c430f1d217e2 100644 --- a/fs/jffs2/summary.c +++ b/fs/jffs2/summary.c | |||
@@ -310,8 +310,6 @@ int jffs2_sum_add_kvec(struct jffs2_sb_info *c, const struct kvec *invecs, | |||
310 | #ifdef CONFIG_JFFS2_FS_XATTR | 310 | #ifdef CONFIG_JFFS2_FS_XATTR |
311 | case JFFS2_NODETYPE_XATTR: { | 311 | case JFFS2_NODETYPE_XATTR: { |
312 | struct jffs2_sum_xattr_mem *temp; | 312 | struct jffs2_sum_xattr_mem *temp; |
313 | if (je32_to_cpu(node->x.version) == 0xffffffff) | ||
314 | return 0; | ||
315 | temp = kmalloc(sizeof(struct jffs2_sum_xattr_mem), GFP_KERNEL); | 313 | temp = kmalloc(sizeof(struct jffs2_sum_xattr_mem), GFP_KERNEL); |
316 | if (!temp) | 314 | if (!temp) |
317 | goto no_mem; | 315 | goto no_mem; |
@@ -327,10 +325,6 @@ int jffs2_sum_add_kvec(struct jffs2_sb_info *c, const struct kvec *invecs, | |||
327 | } | 325 | } |
328 | case JFFS2_NODETYPE_XREF: { | 326 | case JFFS2_NODETYPE_XREF: { |
329 | struct jffs2_sum_xref_mem *temp; | 327 | struct jffs2_sum_xref_mem *temp; |
330 | |||
331 | if (je32_to_cpu(node->r.ino) == 0xffffffff | ||
332 | && je32_to_cpu(node->r.xid) == 0xffffffff) | ||
333 | return 0; | ||
334 | temp = kmalloc(sizeof(struct jffs2_sum_xref_mem), GFP_KERNEL); | 328 | temp = kmalloc(sizeof(struct jffs2_sum_xref_mem), GFP_KERNEL); |
335 | if (!temp) | 329 | if (!temp) |
336 | goto no_mem; | 330 | goto no_mem; |
@@ -483,22 +477,20 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras | |||
483 | 477 | ||
484 | xd = jffs2_setup_xattr_datum(c, je32_to_cpu(spx->xid), | 478 | xd = jffs2_setup_xattr_datum(c, je32_to_cpu(spx->xid), |
485 | je32_to_cpu(spx->version)); | 479 | je32_to_cpu(spx->version)); |
486 | if (IS_ERR(xd)) { | 480 | if (IS_ERR(xd)) |
487 | if (PTR_ERR(xd) == -EEXIST) { | ||
488 | /* a newer version of xd exists */ | ||
489 | if ((err = jffs2_scan_dirty_space(c, jeb, je32_to_cpu(spx->totlen)))) | ||
490 | return err; | ||
491 | sp += JFFS2_SUMMARY_XATTR_SIZE; | ||
492 | break; | ||
493 | } | ||
494 | JFFS2_NOTICE("allocation of xattr_datum failed\n"); | ||
495 | return PTR_ERR(xd); | 481 | return PTR_ERR(xd); |
482 | if (xd->version > je32_to_cpu(spx->version)) { | ||
483 | /* node is not the newest one */ | ||
484 | struct jffs2_raw_node_ref *raw | ||
485 | = sum_link_node_ref(c, jeb, je32_to_cpu(spx->offset) | REF_UNCHECKED, | ||
486 | PAD(je32_to_cpu(spx->totlen)), NULL); | ||
487 | raw->next_in_ino = xd->node->next_in_ino; | ||
488 | xd->node->next_in_ino = raw; | ||
489 | } else { | ||
490 | xd->version = je32_to_cpu(spx->version); | ||
491 | sum_link_node_ref(c, jeb, je32_to_cpu(spx->offset) | REF_UNCHECKED, | ||
492 | PAD(je32_to_cpu(spx->totlen)), (void *)xd); | ||
496 | } | 493 | } |
497 | |||
498 | xd->node = sum_link_node_ref(c, jeb, je32_to_cpu(spx->offset) | REF_UNCHECKED, | ||
499 | PAD(je32_to_cpu(spx->totlen)), NULL); | ||
500 | /* FIXME */ xd->node->next_in_ino = (void *)xd; | ||
501 | |||
502 | *pseudo_random += je32_to_cpu(spx->xid); | 494 | *pseudo_random += je32_to_cpu(spx->xid); |
503 | sp += JFFS2_SUMMARY_XATTR_SIZE; | 495 | sp += JFFS2_SUMMARY_XATTR_SIZE; |
504 | 496 | ||
@@ -519,14 +511,11 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras | |||
519 | JFFS2_NOTICE("allocation of xattr_datum failed\n"); | 511 | JFFS2_NOTICE("allocation of xattr_datum failed\n"); |
520 | return -ENOMEM; | 512 | return -ENOMEM; |
521 | } | 513 | } |
522 | ref->ino = 0xfffffffe; | ||
523 | ref->xid = 0xfffffffd; | ||
524 | ref->next = c->xref_temp; | 514 | ref->next = c->xref_temp; |
525 | c->xref_temp = ref; | 515 | c->xref_temp = ref; |
526 | 516 | ||
527 | ref->node = sum_link_node_ref(c, jeb, je32_to_cpu(spr->offset) | REF_UNCHECKED, | 517 | sum_link_node_ref(c, jeb, je32_to_cpu(spr->offset) | REF_UNCHECKED, |
528 | PAD(sizeof(struct jffs2_raw_xref)), NULL); | 518 | PAD(sizeof(struct jffs2_raw_xref)), (void *)ref); |
529 | /* FIXME */ ref->node->next_in_ino = (void *)ref; | ||
530 | 519 | ||
531 | *pseudo_random += ref->node->flash_offset; | 520 | *pseudo_random += ref->node->flash_offset; |
532 | sp += JFFS2_SUMMARY_XREF_SIZE; | 521 | sp += JFFS2_SUMMARY_XREF_SIZE; |