diff options
Diffstat (limited to 'fs/jffs2/summary.c')
-rw-r--r-- | fs/jffs2/summary.c | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c index be1acc3dad97..c19bd476e8ec 100644 --- a/fs/jffs2/summary.c +++ b/fs/jffs2/summary.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * Zoltan Sogor <weth@inf.u-szeged.hu>, | 5 | * Zoltan Sogor <weth@inf.u-szeged.hu>, |
6 | * Patrik Kluba <pajko@halom.u-szeged.hu>, | 6 | * Patrik Kluba <pajko@halom.u-szeged.hu>, |
7 | * University of Szeged, Hungary | 7 | * University of Szeged, Hungary |
8 | * 2005 KaiGai Kohei <kaigai@ak.jp.nec.com> | 8 | * 2006 KaiGai Kohei <kaigai@ak.jp.nec.com> |
9 | * | 9 | * |
10 | * For licensing information, see the file 'LICENCE' in this directory. | 10 | * For licensing information, see the file 'LICENCE' in this directory. |
11 | * | 11 | * |
@@ -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; |