diff options
author | KaiGai Kohei <kaigai@ak.jp.nec.com> | 2006-06-10 21:35:15 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-06-27 11:16:26 -0400 |
commit | c9f700f840bd481b3e01fcad1ba8da01794a6726 (patch) | |
tree | 786f4a6a3f3a2d619ae4230a62f95361fcd3245a /fs/jffs2/summary.c | |
parent | 6d4f8224d4ee065e0e3186cc554468d735e6015d (diff) |
[JFFS2][XATTR] using 'delete marker' for xdatum/xref deletion
- When xdatum is removed, a new xdatum with 'delete marker' is
written. (version==0xffffffff means 'delete marker')
- When xref is removed, a new xref with 'delete marker' is written.
(odd-numbered xseqno means 'delete marker')
- delete_xattr_(datum/xref)_delay() are new deletion functions
are added. We can only use them if we can detect the target
obsolete xdatum/xref as a orphan or errir one.
(e.g when inode deletion, or detecting crc error)
[1/3] jffs2-xattr-v6-01-delete_marker.patch
Signed-off-by: KaiGai Kohei <kaigai@ak.jp.nec.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
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; |