diff options
author | phk <phk@FreeBSD.org> | 2003-07-18 10:26:09 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-07-18 10:26:09 +0000 |
commit | 5fa40a32657fa0c3bd8a986099bb65516d11e97b (patch) | |
tree | f65e135aef6b67bb4e1d27be159856b438db243f /sys/vm/swap_pager.c | |
parent | 84f9cb2fa862e169a92c4dc14584dda3a33c2a89 (diff) | |
download | FreeBSD-src-5fa40a32657fa0c3bd8a986099bb65516d11e97b.zip FreeBSD-src-5fa40a32657fa0c3bd8a986099bb65516d11e97b.tar.gz |
Add a new function swap_pager_status() which reports the total size of the
paging space and how much of it is in use (in pages).
Use this interface from the Linuxolator instead of groping around in the
internals of the swap_pager.
Diffstat (limited to 'sys/vm/swap_pager.c')
-rw-r--r-- | sys/vm/swap_pager.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index faf9075..38806a1 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -142,7 +142,7 @@ static int nsw_wcount_async; /* limit write buffers / asynchronous */ static int nsw_wcount_async_max;/* assigned maximum */ static int nsw_cluster_max; /* maximum VOP I/O allowed */ -struct blist *swapblist; +static struct blist *swapblist; static struct swblock **swhash; static int swhash_mask; static int swap_async_max = 4; /* maximum in-progress async I/O's */ @@ -2666,6 +2666,22 @@ done2: return (error); } +void +swap_pager_status(int *total, int *used) +{ + struct swdevt *sp; + int i; + + *total = 0; + *used = 0; + for (sp = swdevt, i = 0; i < nswdev; i++, sp++) { + if (sp->sw_vp == NULL) + continue; + *total += sp->sw_nblks; + *used += sp->sw_used; + } +} + static int sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS) { |