From owner-svn-src-all@FreeBSD.ORG Thu Apr 16 09:37:48 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8A1A1065689; Thu, 16 Apr 2009 09:37:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A6D958FC0C; Thu, 16 Apr 2009 09:37:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3G9bmjK075615; Thu, 16 Apr 2009 09:37:48 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3G9bmwb075614; Thu, 16 Apr 2009 09:37:48 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200904160937.n3G9bmwb075614@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 16 Apr 2009 09:37:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191136 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Apr 2009 09:37:49 -0000 Author: kib Date: Thu Apr 16 09:37:48 2009 New Revision: 191136 URL: http://svn.freebsd.org/changeset/base/191136 Log: In flushbufqueues(), do not allocate sentinel buffer on the stack, struct buf is large. Use sleeping malloc(9) call, and zero the allocated buf as a debugging feature. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Thu Apr 16 09:33:52 2009 (r191135) +++ head/sys/kern/vfs_bio.c Thu Apr 16 09:37:48 2009 (r191136) @@ -2189,7 +2189,7 @@ SYSCTL_INT(_vfs, OID_AUTO, flushwithdeps static int flushbufqueues(struct vnode *lvp, int queue, int flushdeps) { - struct buf sentinel; + struct buf *sentinel; struct vnode *vp; struct mount *mp; struct buf *bp; @@ -2205,14 +2205,15 @@ flushbufqueues(struct vnode *lvp, int qu target = flushbufqtarget; flushed = 0; bp = NULL; - sentinel.b_qindex = QUEUE_SENTINEL; + sentinel = malloc(sizeof(struct buf), M_TEMP, M_WAITOK | M_ZERO); + sentinel->b_qindex = QUEUE_SENTINEL; mtx_lock(&bqlock); - TAILQ_INSERT_HEAD(&bufqueues[queue], &sentinel, b_freelist); + TAILQ_INSERT_HEAD(&bufqueues[queue], sentinel, b_freelist); while (flushed != target) { - bp = TAILQ_NEXT(&sentinel, b_freelist); + bp = TAILQ_NEXT(sentinel, b_freelist); if (bp != NULL) { - TAILQ_REMOVE(&bufqueues[queue], &sentinel, b_freelist); - TAILQ_INSERT_AFTER(&bufqueues[queue], bp, &sentinel, + TAILQ_REMOVE(&bufqueues[queue], sentinel, b_freelist); + TAILQ_INSERT_AFTER(&bufqueues[queue], bp, sentinel, b_freelist); } else break; @@ -2304,8 +2305,9 @@ flushbufqueues(struct vnode *lvp, int qu vn_finished_write(mp); BUF_UNLOCK(bp); } - TAILQ_REMOVE(&bufqueues[queue], &sentinel, b_freelist); + TAILQ_REMOVE(&bufqueues[queue], sentinel, b_freelist); mtx_unlock(&bqlock); + free(sentinel, M_TEMP); return (flushed); }