Lines Matching defs:ref

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