Lines Matching refs:up

225 	struct unr *up;
232 TAILQ_FOREACH(up, &uh->head, list) {
234 if (up->ptr != uh && up->ptr != NULL) {
235 ub = up->ptr;
236 KASSERT (up->len <= NBITS,
238 up->len, NBITS, line));
241 bit_count(ub->map, 0, up->len, &w);
243 } else if (up->ptr != NULL)
244 y += up->len;
291 struct unr *up;
294 up = ptr;
295 TAILQ_INSERT_TAIL(&uh->ppfree, up, list);
301 struct unr *up;
304 while ((up = TAILQ_FIRST(&uh->ppfree)) != NULL) {
305 TAILQ_REMOVE(&uh->ppfree, up, list);
307 Free(up);
370 is_bitmap(struct unrhdr *uh, struct unr *up)
372 return (up->ptr != uh && up->ptr != NULL);
387 struct unr *up, *uf, *us;
404 up = uf;
406 up = TAILQ_NEXT(up, list);
407 if (up == NULL)
409 if ((up->len + l) > NBITS)
412 if (is_bitmap(uh, up))
414 l += up->len;
498 collapse_unr(struct unrhdr *uh, struct unr *up)
504 if (is_bitmap(uh, up)) {
505 ub = up->ptr;
506 if (ub_full(ub, up->len)) {
507 delete_unr(uh, up->ptr);
508 up->ptr = uh;
509 } else if (ub_empty(ub, up->len)) {
510 delete_unr(uh, up->ptr);
511 up->ptr = NULL;
516 if (up->len == 0) {
517 upp = TAILQ_PREV(up, unrhd, list);
519 upp = TAILQ_NEXT(up, list);
520 TAILQ_REMOVE(&uh->head, up, list);
521 delete_unr(uh, up);
522 up = upp;
526 if (up != NULL) {
527 upp = TAILQ_PREV(up, unrhd, list);
528 if (upp != NULL && up->ptr == upp->ptr) {
529 up->len += upp->len;
533 upp = TAILQ_NEXT(up, list);
534 if (upp != NULL && up->ptr == upp->ptr) {
535 up->len += upp->len;
547 if (up == upp)
548 up = NULL;
557 if (up == upp)
558 up = NULL;
572 struct unr *up;
581 up = TAILQ_FIRST(&uh->head);
586 if (up == NULL && uh->last > 0) {
597 if (up == NULL)
600 KASSERT(up->ptr != uh, ("UNR first element is allocated"));
602 if (up->ptr == NULL) { /* free run */
604 up->len--;
606 ub = up->ptr;
607 bit_ffc(ub->map, up->len, &y);
613 collapse_unr(uh, up);
632 struct unr *up, *upn;
641 up = TAILQ_FIRST(&uh->head);
643 if (up == NULL && item - uh->low == uh->first) {
653 if (up == NULL) {
654 up = new_unr(uh, p1, p2);
655 up->ptr = NULL;
656 up->len = i;
657 TAILQ_INSERT_TAIL(&uh->head, up, list);
658 up = new_unr(uh, p1, p2);
659 up->ptr = uh;
660 up->len = 1;
661 TAILQ_INSERT_TAIL(&uh->head, up, list);
668 TAILQ_FOREACH(up, &uh->head, list) {
669 if (up->len > i)
671 i -= up->len;
675 if (up == NULL) {
677 up = new_unr(uh, p1, p2);
678 up->ptr = NULL;
679 up->len = i;
680 TAILQ_INSERT_TAIL(&uh->head, up, list);
682 up = new_unr(uh, p1, p2);
683 up->ptr = uh;
684 up->len = 1;
685 TAILQ_INSERT_TAIL(&uh->head, up, list);
689 if (is_bitmap(uh, up)) {
690 ub = up->ptr;
696 } else if (up->ptr == uh)
699 KASSERT(up->ptr == NULL,
700 ("alloc_unr_specificl: up->ptr != NULL (up=%p)", up));
703 tl = up->len - (1 + i);
708 TAILQ_INSERT_AFTER(&uh->head, up, upn, list);
716 TAILQ_INSERT_BEFORE(up, upn, list);
718 up->len = 1;
719 up->ptr = uh;
726 collapse_unr(uh, up);
762 struct unr *up, *upp, *upn;
787 up = new_unr(uh, p1, p2);
788 up->ptr = uh;
789 up->len = uh->first - item;
790 TAILQ_INSERT_HEAD(&uh->head, up, list);
791 uh->first -= up->len;
797 TAILQ_FOREACH(up, &uh->head, list) {
798 if (up->len > item)
800 item -= up->len;
804 if (is_bitmap(uh, up)) {
805 ub = up->ptr;
811 collapse_unr(uh, up);
815 KASSERT(up->ptr == uh, ("UNR Freeing free item %d (run))\n", item));
818 if (up->len == 1) {
819 up->ptr = NULL;
821 collapse_unr(uh, up);
826 upp = TAILQ_PREV(up, unrhd, list);
829 up->len--;
831 collapse_unr(uh, up);
836 upn = TAILQ_NEXT(up, list);
837 if (item == up->len - 1 && upn != NULL && upn->ptr == NULL) {
839 up->len--;
841 collapse_unr(uh, up);
846 pl = up->len - (1 + item);
851 TAILQ_INSERT_AFTER(&uh->head, up, upp, list);
859 TAILQ_INSERT_BEFORE(up, upp, list);
861 up->len = 1;
862 up->ptr = NULL;
864 collapse_unr(uh, up);
896 print_unr(struct unrhdr *uh, struct unr *up)
901 printf(" %p len = %5u ", up, up->len);
902 if (up->ptr == NULL)
904 else if (up->ptr == uh)
907 ub = up->ptr;
909 for (x = 0; x < up->len; x++) {
922 struct unr *up;
929 TAILQ_FOREACH(up, &uh->head, list) {
931 print_unr(uh, up);
932 if (up->ptr == NULL || up->ptr == uh)
933 x += up->len;