diff options
-rw-r--r-- | sys/kern/kern_sysctl.c | 10 | ||||
-rw-r--r-- | sys/kern/vfs_bio.c | 30 | ||||
-rw-r--r-- | sys/kern/vfs_biomem.c | 3 | ||||
-rw-r--r-- | sys/sys/buf.h | 8 |
4 files changed, 25 insertions, 26 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index acb3aa89de7..e6783216459 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.238 2013/06/11 21:51:55 tedu Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.239 2013/06/13 15:00:04 tedu Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -579,10 +579,10 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, return (EINVAL); } if (bufcachepercent != opct) { - pgs = (b_highpages_total + b_dmapages_total) * - bufcachepercent / 100; - b_dmamaxpages = b_dmapages_total * bufcachepercent / - 100; + pgs = (b_highpages_total + b_dmapages_total) + * bufcachepercent / 100; + b_dmamaxpages = b_dmapages_total * bufcachepercent + / 100; bufadjust(pgs); /* adjust bufpages */ bufhighpages = bufpages; /* set high water mark */ } diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index bdc0b0fbf78..57f6659c014 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_bio.c,v 1.149 2013/06/11 21:51:55 tedu Exp $ */ +/* $OpenBSD: vfs_bio.c,v 1.150 2013/06/13 15:00:04 tedu Exp $ */ /* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */ /* @@ -183,7 +183,7 @@ buf_put(struct buf *bp) bcstats.numbufs--; if (buf_dealloc_mem(bp) != 0) - return; + return; pool_put(&bufpool, bp); } @@ -223,8 +223,8 @@ bufinit(void) KASSERT(bufcachepercent <= 90); KASSERT(bufcachepercent >= 5); if (bufpages == 0) - bufpages = (b_dmapages_total + b_highpages_total) * - bufcachepercent / 100; + bufpages = (b_dmapages_total + b_highpages_total) + * bufcachepercent / 100; if (bufpages < BCACHE_MIN) bufpages = BCACHE_MIN; @@ -326,7 +326,7 @@ bufadjust(int newbufpages) if (!growing && (bcstats.numbufpages > lopages)) { if (bfreeclean(bcstats.numbufpages - lopages, &bufqueues[BQ_CLEANH]) != 0) - (void)bfreeclean(bcstats.numbufpages - lopages, + (void) bfreeclean(bcstats.numbufpages - lopages, &bufqueues[BQ_CLEANL]); } @@ -373,16 +373,17 @@ bufbackoff(struct uvm_constraint_range *range, long size) pdelta = bufpages - buflowpages; oldbufpages = bufpages; - if (b_highpages_total && - (range->ucr_high <= dma_constraint.ucr_high)) { + if (b_highpages_total + && (range->ucr_high <= dma_constraint.ucr_high)) { /* * Free up DMA accessible memory by moving pages to * the high range. */ if (bufhigh(pdelta) == 0) return(0); /* we moved enough pages up high */ - else + else { bufadjust(bufpages - pdelta); /* shrink the cache. */ + } } else { /* Free memory by shrinking the cache. */ bufadjust(bufpages - pdelta); @@ -1025,9 +1026,9 @@ buf_get(struct vnode *vp, daddr_t blkno, size_t size) */ if (bcstats.numbufpages + npages > hipages) { if (bfreeclean(bcstats.numbufpages - lopages, - &bufqueues[BQ_CLEANH]) != 0) - (void)bfreeclean(bcstats.numbufpages - - lopages, &bufqueues[BQ_CLEANL]); + &bufqueues[BQ_CLEANH]) != 0) + (void) bfreeclean(bcstats.numbufpages + - lopages, &bufqueues[BQ_CLEANL]); } @@ -1350,7 +1351,6 @@ bufhigh(int delta) psize_t newdmapages; struct buf *b, *bn; int s; - if (!b_highpages_total) return(-1); s = splbio(); @@ -1374,10 +1374,10 @@ bufhigh(int delta) buf_release(b); } else { /* free up some high memory and try again. */ - if (bfreeclean(delta, - &bufqueues[BQ_CLEANH]) == 0) { + if (bfreeclean(delta, &bufqueues[BQ_CLEANH]) + == 0) goto moveit; - } else { + else { /* otherwise just free the buffer */ buf_release(b); if (b->b_vp) { diff --git a/sys/kern/vfs_biomem.c b/sys/kern/vfs_biomem.c index 51dd8261b9c..be2868af7b3 100644 --- a/sys/kern/vfs_biomem.c +++ b/sys/kern/vfs_biomem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_biomem.c,v 1.25 2013/06/11 21:51:55 tedu Exp $ */ +/* $OpenBSD: vfs_biomem.c,v 1.26 2013/06/13 15:00:04 tedu Exp $ */ /* * Copyright (c) 2007 Artur Grabowski <art@openbsd.org> * Copyright (c) 2012,2013 Bob Beck <beck@openbsd.org> @@ -333,7 +333,6 @@ buf_realloc_pages(struct buf *bp, struct uvm_constraint_range *where, vaddr_t va; int dma; int i, r; - KASSERT(!(flags & UVM_PLA_WAITOK) ^ !(flags & UVM_PLA_NOWAIT)); splassert(IPL_BIO); diff --git a/sys/sys/buf.h b/sys/sys/buf.h index 587c14befa6..3c6696436a0 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.h,v 1.87 2013/06/11 21:51:54 tedu Exp $ */ +/* $OpenBSD: buf.h,v 1.88 2013/06/13 15:00:04 tedu Exp $ */ /* $NetBSD: buf.h,v 1.25 1997/04/09 21:12:17 mycroft Exp $ */ /* @@ -234,8 +234,8 @@ struct buf { #define B_SCANNED 0x00100000 /* Block already pushed during sync */ #define B_PDAEMON 0x00200000 /* I/O started by pagedaemon */ #define B_RELEASED 0x00400000 /* free this buffer after its kvm */ -#define B_BC 0x00800000 /* Managed by the Buffer Cache. */ -#define B_DMA 0x01000000 /* DMA reachable. */ +#define B_BC 0x00800000 /* Managed by the Buffer Cache. */ +#define B_DMA 0x01000000 /* DMA reachable. */ #define B_BITS "\20\001AGE\002NEEDCOMMIT\003ASYNC\004BAD\005BUSY" \ "\006CACHE\007CALL\010DELWRI\011DONE\012EINTR\013ERROR" \ @@ -306,7 +306,7 @@ void brelse(struct buf *); void bremfree(struct buf *); void bufinit(void); void buf_dirty(struct buf *); -void buf_undirty(struct buf *); +void buf_undirty(struct buf *); void buf_dma(struct buf *); int bwrite(struct buf *); struct buf *getblk(struct vnode *, daddr_t, int, int, int); |