From owner-svn-src-all@FreeBSD.ORG Sat Feb 12 01:00:00 2011 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 D60BD1065672; Sat, 12 Feb 2011 01:00:00 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A8F5D8FC0C; Sat, 12 Feb 2011 01:00:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1C100K0079902; Sat, 12 Feb 2011 01:00:00 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1C100nK079899; Sat, 12 Feb 2011 01:00:00 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201102120100.p1C100nK079899@svn.freebsd.org> From: Alan Cox Date: Sat, 12 Feb 2011 01:00:00 +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: r218589 - in head/sys: kern vm 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: Sat, 12 Feb 2011 01:00:01 -0000 Author: alc Date: Sat Feb 12 01:00:00 2011 New Revision: 218589 URL: http://svn.freebsd.org/changeset/base/218589 Log: Retire VFS_BIO_DEBUG. Convert those checks that were still valid into KASSERT()s and eliminate the rest. Replace excessive printf()s and a panic() in bufdone_finish() with a KASSERT() in vm_page_io_finish(). Reviewed by: kib Modified: head/sys/kern/vfs_bio.c head/sys/vm/vm_page.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sat Feb 12 00:07:40 2011 (r218588) +++ head/sys/kern/vfs_bio.c Sat Feb 12 01:00:00 2011 (r218589) @@ -2830,11 +2830,6 @@ loop: if (vmio) { bp->b_flags |= B_VMIO; -#if defined(VFS_BIO_DEBUG) - if (vn_canvmio(vp) != TRUE) - printf("getblk: VMIO on vnode type %d\n", - vp->v_type); -#endif KASSERT(vp->v_object == bp->b_bufobj->bo_object, ("ARGH! different b_bufobj->bo_object %p %p %p\n", bp, vp->v_object, bp->b_bufobj->bo_object)); @@ -3343,36 +3338,26 @@ bufdone_finish(struct buf *bp) buf_complete(bp); if (bp->b_flags & B_VMIO) { - int i; vm_ooffset_t foff; vm_page_t m; vm_object_t obj; - int bogus, iosize; - struct vnode *vp = bp->b_vp; + struct vnode *vp; + int bogus, i, iosize; obj = bp->b_bufobj->bo_object; - -#if defined(VFS_BIO_DEBUG) - mp_fixme("usecount and vflag accessed without locks."); - if (vp->v_usecount == 0) { - panic("biodone: zero vnode ref count"); - } - + KASSERT(obj->paging_in_progress >= bp->b_npages, + ("biodone_finish: paging in progress(%d) < b_npages(%d)", + obj->paging_in_progress, bp->b_npages)); + + vp = bp->b_vp; + KASSERT(vp->v_holdcnt > 0, + ("biodone_finish: vnode %p has zero hold count", vp)); KASSERT(vp->v_object != NULL, - ("biodone: vnode %p has no vm_object", vp)); -#endif + ("biodone_finish: vnode %p has no vm_object", vp)); foff = bp->b_offset; KASSERT(bp->b_offset != NOOFFSET, - ("biodone: no buffer offset")); - - VM_OBJECT_LOCK(obj); -#if defined(VFS_BIO_DEBUG) - if (obj->paging_in_progress < bp->b_npages) { - printf("biodone: paging in progress(%d) < bp->b_npages(%d)\n", - obj->paging_in_progress, bp->b_npages); - } -#endif + ("biodone_finish: bp %p has no buffer offset", bp)); /* * Set B_CACHE if the op was a normal read and no error @@ -3386,6 +3371,7 @@ bufdone_finish(struct buf *bp) bp->b_flags |= B_CACHE; } bogus = 0; + VM_OBJECT_LOCK(obj); for (i = 0; i < bp->b_npages; i++) { int bogusflag = 0; int resid; @@ -3405,13 +3391,9 @@ bufdone_finish(struct buf *bp) panic("biodone: page disappeared!"); bp->b_pages[i] = m; } -#if defined(VFS_BIO_DEBUG) - if (OFF_TO_IDX(foff) != m->pindex) { - printf( -"biodone: foff(%jd)/m->pindex(%ju) mismatch\n", - (intmax_t)foff, (uintmax_t)m->pindex); - } -#endif + KASSERT(OFF_TO_IDX(foff) == m->pindex, + ("biodone_finish: foff(%jd)/pindex(%ju) mismatch", + (intmax_t)foff, (uintmax_t)m->pindex)); /* * In the write case, the valid and clean bits are @@ -3425,31 +3407,6 @@ bufdone_finish(struct buf *bp) vfs_page_set_valid(bp, foff, m); } - /* - * when debugging new filesystems or buffer I/O methods, this - * is the most common error that pops up. if you see this, you - * have not set the page busy flag correctly!!! - */ - if (m->busy == 0) { - printf("biodone: page busy < 0, " - "pindex: %d, foff: 0x(%x,%x), " - "resid: %d, index: %d\n", - (int) m->pindex, (int)(foff >> 32), - (int) foff & 0xffffffff, resid, i); - if (!vn_isdisk(vp, NULL)) - printf(" iosize: %jd, lblkno: %jd, flags: 0x%x, npages: %d\n", - (intmax_t)bp->b_vp->v_mount->mnt_stat.f_iosize, - (intmax_t) bp->b_lblkno, - bp->b_flags, bp->b_npages); - else - printf(" VDEV, lblkno: %jd, flags: 0x%x, npages: %d\n", - (intmax_t) bp->b_lblkno, - bp->b_flags, bp->b_npages); - printf(" valid: 0x%lx, dirty: 0x%lx, wired: %d\n", - (u_long)m->valid, (u_long)m->dirty, - m->wire_count); - panic("biodone: page busy < 0\n"); - } vm_page_io_finish(m); vm_object_pip_subtract(obj, 1); foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Feb 12 00:07:40 2011 (r218588) +++ head/sys/vm/vm_page.c Sat Feb 12 01:00:00 2011 (r218589) @@ -557,6 +557,7 @@ vm_page_io_finish(vm_page_t m) { VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); + KASSERT(m->busy > 0, ("vm_page_io_finish: page %p is not busy", m)); m->busy--; if (m->busy == 0) vm_page_flash(m);