summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2011-04-07 19:07:43 +0000
committerBob Beck <beck@cvs.openbsd.org>2011-04-07 19:07:43 +0000
commit702d794d38b4104672f33c0778d343444c8db8ca (patch)
treeb9704f30228c931723da122783009f54f0f5860b
parent6029e115e4cc8da106ff817817175ea0fc0320a8 (diff)
Revert previous diff decrementing bcstats.numbufpages here. This function
does not do what it purports to do, it shrinks mapping, not allocation, as the pages have already been given away to other buffers. This also renames the function to make this a little more obvious and art should not name funcitons ok thib@, art@
-rw-r--r--sys/kern/vfs_bio.c7
-rw-r--r--sys/kern/vfs_biomem.c12
-rw-r--r--sys/sys/buf.h4
3 files changed, 15 insertions, 8 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index c48624f9b3a..045577708c5 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_bio.c,v 1.128 2011/04/02 16:47:17 beck Exp $ */
+/* $OpenBSD: vfs_bio.c,v 1.129 2011/04/07 19:07:42 beck Exp $ */
/* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */
/*
@@ -463,9 +463,10 @@ bread_cluster_callback(struct buf *bp)
size_t newsize = xbpp[1]->b_bufsize;
/*
- * Shrink this buffer to only cover its part of the total I/O.
+ * Shrink this buffer's mapping to only cover its part of
+ * the total I/O.
*/
- buf_shrink_mem(bp, newsize);
+ buf_fix_mapping(bp, newsize);
bp->b_bcount = newsize;
}
diff --git a/sys/kern/vfs_biomem.c b/sys/kern/vfs_biomem.c
index 17c5007441a..e0e1a5f1b39 100644
--- a/sys/kern/vfs_biomem.c
+++ b/sys/kern/vfs_biomem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_biomem.c,v 1.16 2011/04/05 21:31:58 beck Exp $ */
+/* $OpenBSD: vfs_biomem.c,v 1.17 2011/04/07 19:07:42 beck Exp $ */
/*
* Copyright (c) 2007 Artur Grabowski <art@openbsd.org>
*
@@ -223,15 +223,21 @@ buf_dealloc_mem(struct buf *bp)
return (1);
}
+/*
+ * Only used by bread_cluster.
+ */
void
-buf_shrink_mem(struct buf *bp, vsize_t newsize)
+buf_fix_mapping(struct buf *bp, vsize_t newsize)
{
vaddr_t va = (vaddr_t)bp->b_data;
if (newsize < bp->b_bufsize) {
pmap_kremove(va + newsize, bp->b_bufsize - newsize);
pmap_update(pmap_kernel());
- bcstats.numbufpages -= atop(bp->b_bufsize - newsize);
+ /*
+ * Note: the size we lost is actually with the other
+ * buffers read in by bread_cluster
+ */
bp->b_bufsize = newsize;
}
}
diff --git a/sys/sys/buf.h b/sys/sys/buf.h
index 4f3a5a75b49..f383fb6d135 100644
--- a/sys/sys/buf.h
+++ b/sys/sys/buf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.h,v 1.75 2011/04/03 13:52:09 beck Exp $ */
+/* $OpenBSD: buf.h,v 1.76 2011/04/07 19:07:42 beck Exp $ */
/* $NetBSD: buf.h,v 1.25 1997/04/09 21:12:17 mycroft Exp $ */
/*
@@ -295,7 +295,7 @@ void buf_acquire_unmapped(struct buf *);
void buf_map(struct buf *);
void buf_release(struct buf *);
int buf_dealloc_mem(struct buf *);
-void buf_shrink_mem(struct buf *, vsize_t);
+void buf_fix_mapping(struct buf *, vsize_t);
void buf_alloc_pages(struct buf *, vsize_t);
void buf_free_pages(struct buf *);