MCPcopy Create free account
hub / github.com/F-Stack/f-stack / swapoff_all

Function swapoff_all

freebsd/vm/swap_pager.c:2540–2568  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2538}
2539
2540void
2541swapoff_all(void)
2542{
2543 struct swdevt *sp, *spt;
2544 const char *devname;
2545 int error;
2546
2547 sx_xlock(&swdev_syscall_lock);
2548
2549 mtx_lock(&sw_dev_mtx);
2550 TAILQ_FOREACH_SAFE(sp, &swtailq, sw_list, spt) {
2551 mtx_unlock(&sw_dev_mtx);
2552 if (vn_isdisk(sp->sw_vp))
2553 devname = devtoname(sp->sw_vp->v_rdev);
2554 else
2555 devname = "[file]";
2556 error = swapoff_one(sp, thread0.td_ucred);
2557 if (error != 0) {
2558 printf("Cannot remove swap device %s (error=%d), "
2559 "skipping.\n", devname, error);
2560 } else if (bootverbose) {
2561 printf("Swap device %s removed.\n", devname);
2562 }
2563 mtx_lock(&sw_dev_mtx);
2564 }
2565 mtx_unlock(&sw_dev_mtx);
2566
2567 sx_xunlock(&swdev_syscall_lock);
2568}
2569
2570void
2571swap_pager_status(int *total, int *used)

Callers 1

bufshutdownFunction · 0.85

Calls 6

vn_isdiskFunction · 0.85
swapoff_oneFunction · 0.85
mtx_lockFunction · 0.50
mtx_unlockFunction · 0.50
devtonameFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected