Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_vmem.c
Show First 20 Lines • Show All 460 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
/* ---- boundary tag list */ | /* ---- boundary tag list */ | ||||
static void | static void | ||||
bt_remseg(vmem_t *vm, bt_t *bt) | bt_remseg(vmem_t *vm, bt_t *bt) | ||||
{ | { | ||||
MPASS(bt->bt_type != BT_TYPE_CURSOR); | |||||
TAILQ_REMOVE(&vm->vm_seglist, bt, bt_seglist); | TAILQ_REMOVE(&vm->vm_seglist, bt, bt_seglist); | ||||
bt_free(vm, bt); | bt_free(vm, bt); | ||||
} | } | ||||
static void | static void | ||||
bt_insseg(vmem_t *vm, bt_t *bt, bt_t *prev) | bt_insseg(vmem_t *vm, bt_t *bt, bt_t *prev) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 361 Lines • ▼ Show 20 Lines | vmem_destroy1(vmem_t *vm) | ||||
qc_destroy(vm); | qc_destroy(vm); | ||||
/* | /* | ||||
* The vmem should now only contain empty segments. | * The vmem should now only contain empty segments. | ||||
*/ | */ | ||||
VMEM_LOCK(vm); | VMEM_LOCK(vm); | ||||
MPASS(vm->vm_nbusytag == 0); | MPASS(vm->vm_nbusytag == 0); | ||||
TAILQ_REMOVE(&vm->vm_seglist, &vm->vm_cursor, bt_seglist); | |||||
while ((bt = TAILQ_FIRST(&vm->vm_seglist)) != NULL) | while ((bt = TAILQ_FIRST(&vm->vm_seglist)) != NULL) | ||||
jhb: There are some other ways to handle this such as doing TAILQ_REMOVE instead of bt_remseg and… | |||||
Done Inline ActionsI think I would remove the cursor before the loop, if only to avoid an extra local var, but I'm happy with the change either way. markj: I think I would remove the cursor before the loop, if only to avoid an extra local var, but I'm… | |||||
Done Inline ActionsYeah that thought occurred to me this morning as well. It would be a smaller diff by just adding a single line before the loop. I'll test it. jhb: Yeah that thought occurred to me this morning as well. It would be a smaller diff by just… | |||||
bt_remseg(vm, bt); | bt_remseg(vm, bt); | ||||
if (vm->vm_hashlist != NULL && vm->vm_hashlist != vm->vm_hash0) | if (vm->vm_hashlist != NULL && vm->vm_hashlist != vm->vm_hash0) | ||||
free(vm->vm_hashlist, M_VMEM); | free(vm->vm_hashlist, M_VMEM); | ||||
bt_freetrim(vm, 0); | bt_freetrim(vm, 0); | ||||
VMEM_CONDVAR_DESTROY(vm); | VMEM_CONDVAR_DESTROY(vm); | ||||
▲ Show 20 Lines • Show All 926 Lines • Show Last 20 Lines |
There are some other ways to handle this such as doing TAILQ_REMOVE instead of bt_remseg and keeping the while loop instead of TAILQ_FOREACH_SAFE. I'm open to fixing it however you prefer.