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/xattr.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/xattr.c')
-rw-r--r-- | fs/jffs2/xattr.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c index e16f8460ff04..76d166140381 100644 --- a/fs/jffs2/xattr.c +++ b/fs/jffs2/xattr.c | |||
@@ -322,7 +322,6 @@ static int save_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *x | |||
322 | if (!raw) | 322 | if (!raw) |
323 | return -ENOMEM; | 323 | return -ENOMEM; |
324 | raw->flash_offset = phys_ofs; | 324 | raw->flash_offset = phys_ofs; |
325 | raw->next_in_ino = (void *)xd; | ||
326 | 325 | ||
327 | /* Setup raw-xattr */ | 326 | /* Setup raw-xattr */ |
328 | rx.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); | 327 | rx.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); |
@@ -345,8 +344,7 @@ static int save_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *x | |||
345 | rc = rc ? rc : -EIO; | 344 | rc = rc ? rc : -EIO; |
346 | if (length) { | 345 | if (length) { |
347 | raw->flash_offset |= REF_OBSOLETE; | 346 | raw->flash_offset |= REF_OBSOLETE; |
348 | raw->next_in_ino = NULL; | 347 | jffs2_add_physical_node_ref(c, raw, PAD(totlen), NULL); |
349 | jffs2_add_physical_node_ref(c, raw, PAD(totlen)); | ||
350 | jffs2_mark_node_obsolete(c, raw); | 348 | jffs2_mark_node_obsolete(c, raw); |
351 | } else { | 349 | } else { |
352 | jffs2_free_raw_node_ref(raw); | 350 | jffs2_free_raw_node_ref(raw); |
@@ -356,7 +354,9 @@ static int save_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *x | |||
356 | 354 | ||
357 | /* success */ | 355 | /* success */ |
358 | raw->flash_offset |= REF_PRISTINE; | 356 | raw->flash_offset |= REF_PRISTINE; |
359 | jffs2_add_physical_node_ref(c, raw, PAD(totlen)); | 357 | jffs2_add_physical_node_ref(c, raw, PAD(totlen), NULL); |
358 | /* FIXME */ raw->next_in_ino = (void *)xd; | ||
359 | |||
360 | if (xd->node) | 360 | if (xd->node) |
361 | delete_xattr_datum_node(c, xd); | 361 | delete_xattr_datum_node(c, xd); |
362 | xd->node = raw; | 362 | xd->node = raw; |
@@ -566,7 +566,6 @@ static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref, | |||
566 | if (!raw) | 566 | if (!raw) |
567 | return -ENOMEM; | 567 | return -ENOMEM; |
568 | raw->flash_offset = phys_ofs; | 568 | raw->flash_offset = phys_ofs; |
569 | raw->next_in_ino = (void *)ref; | ||
570 | 569 | ||
571 | rr.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); | 570 | rr.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); |
572 | rr.nodetype = cpu_to_je16(JFFS2_NODETYPE_XREF); | 571 | rr.nodetype = cpu_to_je16(JFFS2_NODETYPE_XREF); |
@@ -584,8 +583,7 @@ static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref, | |||
584 | ret = ret ? ret : -EIO; | 583 | ret = ret ? ret : -EIO; |
585 | if (length) { | 584 | if (length) { |
586 | raw->flash_offset |= REF_OBSOLETE; | 585 | raw->flash_offset |= REF_OBSOLETE; |
587 | raw->next_in_ino = NULL; | 586 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(rr)), NULL); |
588 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(rr))); | ||
589 | jffs2_mark_node_obsolete(c, raw); | 587 | jffs2_mark_node_obsolete(c, raw); |
590 | } else { | 588 | } else { |
591 | jffs2_free_raw_node_ref(raw); | 589 | jffs2_free_raw_node_ref(raw); |
@@ -594,7 +592,8 @@ static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref, | |||
594 | } | 592 | } |
595 | raw->flash_offset |= REF_PRISTINE; | 593 | raw->flash_offset |= REF_PRISTINE; |
596 | 594 | ||
597 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(rr))); | 595 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(rr)), NULL); |
596 | /* FIXME */ raw->next_in_ino = (void *)ref; | ||
598 | if (ref->node) | 597 | if (ref->node) |
599 | delete_xattr_ref_node(c, ref); | 598 | delete_xattr_ref_node(c, ref); |
600 | ref->node = raw; | 599 | ref->node = raw; |