ok?
Index: vfs_bio.c
===================================================================
RCS file: /cvs/src/sys/kern/vfs_bio.c,v
retrieving revision 1.173
diff -u -p -r1.173 vfs_bio.c
--- vfs_bio.c 10 Mar 2016 03:09:45 -0000 1.173
+++ vfs_bio.c 10 Mar 2016 07:15:57 -0000
@@ -1292,14 +1292,14 @@ buf_adjcnt(struct buf *bp, long ncount)
* this function is called when a hot or warm queue may have exceeded its
* size limit. it will move a buf to the coldqueue.
*/
-int chillbufs(struct
- bufcache *cache, struct bufqueue *queue, int64_t *queuepages);
+int chillbufs(struct bufcache *, struct bufqueue *, int64_t *);
void
bufcache_init(void)
{
int i;
- for (i=0; i < NUM_CACHES; i++) {
+
+ for (i = 0; i < NUM_CACHES; i++) {
TAILQ_INIT(&cleancache[i].hotqueue);
TAILQ_INIT(&cleancache[i].coldqueue);
TAILQ_INIT(&cleancache[i].warmqueue);
@@ -1314,7 +1314,8 @@ void
bufcache_adjust(void)
{
int i;
- for (i=0; i < NUM_CACHES; i++) {
+
+ for (i = 0; i < NUM_CACHES; i++) {
while (chillbufs(&cleancache[i], &cleancache[i].warmqueue,
&cleancache[i].warmbufpages) ||
chillbufs(&cleancache[i], &cleancache[i].hotqueue,
@@ -1393,7 +1394,7 @@ bufcache_getcleanbuf_range(int start, in
struct buf *
bufcache_getanycleanbuf(void)
{
- return bufcache_getcleanbuf_range(DMA_CACHE, NUM_CACHES -1, 0);
+ return bufcache_getcleanbuf_range(DMA_CACHE, NUM_CACHES-1, 0);
}
@@ -1407,15 +1408,15 @@ void
bufcache_take(struct buf *bp)
{
struct bufqueue *queue;
- int64_t pages;
+ struct bufcache *cache = &cleancache[bp->cache];
+ int64_t pages = atop(bp->b_bufsize);
splassert(IPL_BIO);
KASSERT(ISSET(bp->b_flags, B_BC));
KASSERT(bp->cache >= DMA_CACHE);
KASSERT((bp->cache < NUM_CACHES));
- pages = atop(bp->b_bufsize);
- struct bufcache *cache = &cleancache[bp->cache];
+
if (!ISSET(bp->b_flags, B_DELWRI)) {
if (ISSET(bp->b_flags, B_COLD)) {
queue = &cache->coldqueue;
@@ -1467,14 +1468,16 @@ void
bufcache_release(struct buf *bp)
{
struct bufqueue *queue;
- int64_t pages;
struct bufcache *cache = &cleancache[bp->cache];
- pages = atop(bp->b_bufsize);
+ int64_t pages = atop(bp->b_bufsize);
+
KASSERT(ISSET(bp->b_flags, B_BC));
KASSERT((ISSET(bp->b_flags, B_DMA) && bp->cache == 0)
|| ((!ISSET(bp->b_flags, B_DMA)) && bp->cache > 0));
+
if (!ISSET(bp->b_flags, B_DELWRI)) {
int64_t *queuepages;
+
if (ISSET(bp->b_flags, B_WARM | B_COLD)) {
SET(bp->b_flags, B_WARM);
CLR(bp->b_flags, B_COLD);
@@ -1510,7 +1513,7 @@ hibernate_suspend_bufcache(void)
s = splbio();
/* Chuck away all the cache pages.. discard bufs, do not promote */
- while ((bp = bufcache_getcleanbuf_range(DMA_CACHE, NUM_CACHES - 1, 1)))
{
+ while ((bp = bufcache_getcleanbuf_range(DMA_CACHE, NUM_CACHES-1, 1))) {
bufcache_take(bp);
if (bp->b_vp) {
RB_REMOVE(buf_rb_bufs,