Lines Matching refs:ref

444 static int verify_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref)  in verify_xattr_ref()  argument
454 if (ref_flags(ref->node) != REF_UNCHECKED) in verify_xattr_ref()
456 offset = ref_offset(ref->node); in verify_xattr_ref()
482 ref->ino = je32_to_cpu(rr.ino); in verify_xattr_ref()
483 ref->xid = je32_to_cpu(rr.xid); in verify_xattr_ref()
484 ref->xseqno = je32_to_cpu(rr.xseqno); in verify_xattr_ref()
485 if (ref->xseqno > c->highest_xseqno) in verify_xattr_ref()
486 c->highest_xseqno = (ref->xseqno & ~XREF_DELETE_MARKER); in verify_xattr_ref()
490 for (raw=ref->node; raw != (void *)ref; raw=raw->next_in_ino) { in verify_xattr_ref()
497 raw->flash_offset = ref_offset(raw) | ((ref->node==raw) ? REF_PRISTINE : REF_NORMAL); in verify_xattr_ref()
502 ref->ino, ref->xid, ref_offset(ref->node)); in verify_xattr_ref()
506 static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref) in save_xattr_ref() argument
520 if (is_xattr_ref_dead(ref)) { in save_xattr_ref()
522 rr.ino = cpu_to_je32(ref->ino); in save_xattr_ref()
523 rr.xid = cpu_to_je32(ref->xid); in save_xattr_ref()
525 rr.ino = cpu_to_je32(ref->ic->ino); in save_xattr_ref()
526 rr.xid = cpu_to_je32(ref->xd->xid); in save_xattr_ref()
542 ref->xseqno = xseqno; in save_xattr_ref()
543 jffs2_add_physical_node_ref(c, phys_ofs | REF_PRISTINE, PAD(sizeof(rr)), (void *)ref); in save_xattr_ref()
545 dbg_xattr("success on saving xref (ino=%u, xid=%u)\n", ref->ic->ino, ref->xd->xid); in save_xattr_ref()
554 struct jffs2_xattr_ref *ref; in create_xattr_ref() local
557 ref = jffs2_alloc_xattr_ref(); in create_xattr_ref()
558 if (!ref) in create_xattr_ref()
560 ref->ic = ic; in create_xattr_ref()
561 ref->xd = xd; in create_xattr_ref()
563 ret = save_xattr_ref(c, ref); in create_xattr_ref()
565 jffs2_free_xattr_ref(ref); in create_xattr_ref()
570 ref->next = ic->xref; in create_xattr_ref()
571 ic->xref = ref; in create_xattr_ref()
573 return ref; /* success */ in create_xattr_ref()
576 static void delete_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref) in delete_xattr_ref() argument
581 xd = ref->xd; in delete_xattr_ref()
582 ref->xseqno |= XREF_DELETE_MARKER; in delete_xattr_ref()
583 ref->ino = ref->ic->ino; in delete_xattr_ref()
584 ref->xid = ref->xd->xid; in delete_xattr_ref()
586 ref->next = c->xref_dead_list; in delete_xattr_ref()
587 c->xref_dead_list = ref; in delete_xattr_ref()
591 ref->ino, ref->xid, ref->xseqno); in delete_xattr_ref()
600 struct jffs2_xattr_ref *ref, *_ref; in jffs2_xattr_delete_inode() local
606 for (ref = ic->xref; ref; ref = _ref) { in jffs2_xattr_delete_inode()
607 _ref = ref->next; in jffs2_xattr_delete_inode()
608 delete_xattr_ref(c, ref); in jffs2_xattr_delete_inode()
618 struct jffs2_xattr_ref *ref, *_ref; in jffs2_xattr_free_inode() local
621 for (ref = ic->xref; ref; ref = _ref) { in jffs2_xattr_free_inode()
622 _ref = ref->next; in jffs2_xattr_free_inode()
623 xd = ref->xd; in jffs2_xattr_free_inode()
628 jffs2_free_xattr_ref(ref); in jffs2_xattr_free_inode()
640 struct jffs2_xattr_ref *ref, *cmp, **pref, **pcmp; in check_xattr_ref_inode() local
648 for (ref=ic->xref, pref=&ic->xref; ref; pref=&ref->next, ref=ref->next) { in check_xattr_ref_inode()
649 if (!ref->xd->xname) { in check_xattr_ref_inode()
650 rc = load_xattr_datum(c, ref->xd); in check_xattr_ref_inode()
652 *pref = ref->next; in check_xattr_ref_inode()
653 delete_xattr_ref(c, ref); in check_xattr_ref_inode()
658 for (cmp=ref->next, pcmp=&ref->next; cmp; pcmp=&cmp->next, cmp=cmp->next) { in check_xattr_ref_inode()
660 ref->xd->flags |= JFFS2_XFLAGS_BIND; in check_xattr_ref_inode()
662 ref->xd->flags &= ~JFFS2_XFLAGS_BIND; in check_xattr_ref_inode()
670 if (ref->xd->xprefix == cmp->xd->xprefix in check_xattr_ref_inode()
671 && !strcmp(ref->xd->xname, cmp->xd->xname)) { in check_xattr_ref_inode()
672 if (ref->xseqno > cmp->xseqno) { in check_xattr_ref_inode()
676 *pref = ref->next; in check_xattr_ref_inode()
677 delete_xattr_ref(c, ref); in check_xattr_ref_inode()
743 struct jffs2_xattr_ref *ref, *_ref; in jffs2_clear_xattr_subsystem() local
746 for (ref=c->xref_temp; ref; ref = _ref) { in jffs2_clear_xattr_subsystem()
747 _ref = ref->next; in jffs2_clear_xattr_subsystem()
748 jffs2_free_xattr_ref(ref); in jffs2_clear_xattr_subsystem()
751 for (ref=c->xref_dead_list; ref; ref = _ref) { in jffs2_clear_xattr_subsystem()
752 _ref = ref->next; in jffs2_clear_xattr_subsystem()
753 jffs2_free_xattr_ref(ref); in jffs2_clear_xattr_subsystem()
777 struct jffs2_xattr_ref *ref, *_ref; in jffs2_build_xattr_subsystem() local
793 for (ref=c->xref_temp; ref; ref=_ref) { in jffs2_build_xattr_subsystem()
796 _ref = ref->next; in jffs2_build_xattr_subsystem()
797 if (ref_flags(ref->node) != REF_PRISTINE) { in jffs2_build_xattr_subsystem()
798 if (verify_xattr_ref(c, ref)) { in jffs2_build_xattr_subsystem()
799 BUG_ON(ref->node->next_in_ino != (void *)ref); in jffs2_build_xattr_subsystem()
800 ref->node->next_in_ino = NULL; in jffs2_build_xattr_subsystem()
801 jffs2_mark_node_obsolete(c, ref->node); in jffs2_build_xattr_subsystem()
802 jffs2_free_xattr_ref(ref); in jffs2_build_xattr_subsystem()
807 i = (ref->ino ^ ref->xid) % XREF_TMPHASH_SIZE; in jffs2_build_xattr_subsystem()
809 if (tmp->ino == ref->ino && tmp->xid == ref->xid) in jffs2_build_xattr_subsystem()
813 raw = ref->node; in jffs2_build_xattr_subsystem()
814 if (ref->xseqno > tmp->xseqno) { in jffs2_build_xattr_subsystem()
815 tmp->xseqno = ref->xseqno; in jffs2_build_xattr_subsystem()
822 jffs2_free_xattr_ref(ref); in jffs2_build_xattr_subsystem()
825 ref->next = xref_tmphash[i]; in jffs2_build_xattr_subsystem()
826 xref_tmphash[i] = ref; in jffs2_build_xattr_subsystem()
833 for (ref=xref_tmphash[i]; ref; ref=_ref) { in jffs2_build_xattr_subsystem()
835 _ref = ref->next; in jffs2_build_xattr_subsystem()
836 if (is_xattr_ref_dead(ref)) { in jffs2_build_xattr_subsystem()
837 ref->next = c->xref_dead_list; in jffs2_build_xattr_subsystem()
838 c->xref_dead_list = ref; in jffs2_build_xattr_subsystem()
844 xd = jffs2_find_xattr_datum(c, ref->xid); in jffs2_build_xattr_subsystem()
845 ic = jffs2_get_ino_cache(c, ref->ino); in jffs2_build_xattr_subsystem()
848 ref->ino, ref->xid, ref->xseqno); in jffs2_build_xattr_subsystem()
849 ref->xseqno |= XREF_DELETE_MARKER; in jffs2_build_xattr_subsystem()
850 ref->next = c->xref_dead_list; in jffs2_build_xattr_subsystem()
851 c->xref_dead_list = ref; in jffs2_build_xattr_subsystem()
855 ref->xd = xd; in jffs2_build_xattr_subsystem()
856 ref->ic = ic; in jffs2_build_xattr_subsystem()
858 ref->next = ic->xref; in jffs2_build_xattr_subsystem()
859 ic->xref = ref; in jffs2_build_xattr_subsystem()
972 struct jffs2_xattr_ref *ref, **pref; in jffs2_listxattr() local
985 for (ref=ic->xref, pref=&ic->xref; ref; pref=&ref->next, ref=ref->next) { in jffs2_listxattr()
986 BUG_ON(ref->ic != ic); in jffs2_listxattr()
987 xd = ref->xd; in jffs2_listxattr()
998 *pref = ref->next; in jffs2_listxattr()
999 delete_xattr_ref(c, ref); in jffs2_listxattr()
1042 struct jffs2_xattr_ref *ref, **pref; in do_jffs2_getxattr() local
1051 for (ref=ic->xref, pref=&ic->xref; ref; pref=&ref->next, ref=ref->next) { in do_jffs2_getxattr()
1052 BUG_ON(ref->ic!=ic); in do_jffs2_getxattr()
1054 xd = ref->xd; in do_jffs2_getxattr()
1067 *pref = ref->next; in do_jffs2_getxattr()
1068 delete_xattr_ref(c, ref); in do_jffs2_getxattr()
1104 struct jffs2_xattr_ref *ref, *newref, **pref; in do_jffs2_setxattr() local
1123 for (ref=ic->xref, pref=&ic->xref; ref; pref=&ref->next, ref=ref->next) { in do_jffs2_setxattr()
1124 xd = ref->xd; in do_jffs2_setxattr()
1130 *pref = ref->next; in do_jffs2_setxattr()
1131 delete_xattr_ref(c, ref); in do_jffs2_setxattr()
1142 ref->ino = ic->ino; in do_jffs2_setxattr()
1143 ref->xid = xd->xid; in do_jffs2_setxattr()
1144 ref->xseqno |= XREF_DELETE_MARKER; in do_jffs2_setxattr()
1145 rc = save_xattr_ref(c, ref); in do_jffs2_setxattr()
1147 *pref = ref->next; in do_jffs2_setxattr()
1149 ref->next = c->xref_dead_list; in do_jffs2_setxattr()
1150 c->xref_dead_list = ref; in do_jffs2_setxattr()
1154 ref->ic = ic; in do_jffs2_setxattr()
1155 ref->xd = xd; in do_jffs2_setxattr()
1156 ref->xseqno &= ~XREF_DELETE_MARKER; in do_jffs2_setxattr()
1192 if (ref) in do_jffs2_setxattr()
1193 *pref = ref->next; in do_jffs2_setxattr()
1196 if (ref) { in do_jffs2_setxattr()
1197 ref->next = ic->xref; in do_jffs2_setxattr()
1198 ic->xref = ref; in do_jffs2_setxattr()
1202 } else if (ref) { in do_jffs2_setxattr()
1203 delete_xattr_ref(c, ref); in do_jffs2_setxattr()
1259 int jffs2_garbage_collect_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref, in jffs2_garbage_collect_xattr_ref() argument
1266 BUG_ON(!ref->node); in jffs2_garbage_collect_xattr_ref()
1268 if (ref->node != raw) in jffs2_garbage_collect_xattr_ref()
1270 if (is_xattr_ref_dead(ref) && (raw->next_in_ino == (void *)ref)) in jffs2_garbage_collect_xattr_ref()
1273 old_ofs = ref_offset(ref->node); in jffs2_garbage_collect_xattr_ref()
1274 totlen = ref_totlen(c, c->gcblock, ref->node); in jffs2_garbage_collect_xattr_ref()
1282 rc = save_xattr_ref(c, ref); in jffs2_garbage_collect_xattr_ref()
1285 ref->ic->ino, ref->xd->xid, old_ofs, ref_offset(ref->node)); in jffs2_garbage_collect_xattr_ref()
1336 void jffs2_release_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref) in jffs2_release_xattr_ref() argument
1341 if (ref->node != (void *)ref) in jffs2_release_xattr_ref()
1345 if (ref == tmp) { in jffs2_release_xattr_ref()
1350 jffs2_free_xattr_ref(ref); in jffs2_release_xattr_ref()