Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm When preparing to swap to a miniroot partition, add ...
details: https://anonhg.NetBSD.org/src/rev/a5757ff50028
branches: trunk
changeset: 526766:a5757ff50028
user: fredette <fredette%NetBSD.org@localhost>
date: Thu May 09 21:43:44 2002 +0000
description:
When preparing to swap to a miniroot partition, add a little
padding to our estimate of the miniroot's size, to avoid
overwriting it.
diffstat:
sys/uvm/uvm_swap.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diffs (39 lines):
diff -r 57f350d44d77 -r a5757ff50028 sys/uvm/uvm_swap.c
--- a/sys/uvm/uvm_swap.c Thu May 09 20:32:59 2002 +0000
+++ b/sys/uvm/uvm_swap.c Thu May 09 21:43:44 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_swap.c,v 1.63 2002/04/01 12:24:11 manu Exp $ */
+/* $NetBSD: uvm_swap.c,v 1.64 2002/05/09 21:43:44 fredette Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Matthew R. Green
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.63 2002/04/01 12:24:11 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.64 2002/05/09 21:43:44 fredette Exp $");
#include "fs_nfs.h"
#include "opt_uvmhist.h"
@@ -906,6 +906,20 @@
mp = rootvnode->v_mount;
sp = &mp->mnt_stat;
rootblocks = sp->f_blocks * btodb(sp->f_bsize);
+ /*
+ * XXX: sp->f_blocks isn't the total number of
+ * blocks in the filesystem, it's the number of
+ * data blocks. so, our rootblocks almost
+ * definitely underestimates the total size
+ * of the filesystem - how badly depends on the
+ * details of the filesystem type. there isn't
+ * an obvious way to deal with this cleanly
+ * and perfectly, so for now we just pad our
+ * rootblocks estimate with an extra 5 percent.
+ */
+ rootblocks += (rootblocks >> 5) +
+ (rootblocks >> 6) +
+ (rootblocks >> 7);
rootpages = round_page(dbtob(rootblocks)) >> PAGE_SHIFT;
if (rootpages > size)
panic("swap_on: miniroot larger than swap?");
Home |
Main Index |
Thread Index |
Old Index