From owner-svn-src-stable@FreeBSD.ORG Sun Jan 6 15:07:20 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B430DC95; Sun, 6 Jan 2013 15:07:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8D5E4372; Sun, 6 Jan 2013 15:07:20 +0000 (UTC) Received: from svn.freebsd.org (svn.FreeBSD.org [8.8.178.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r06F7KUk085116; Sun, 6 Jan 2013 15:07:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r06F7KlT085111; Sun, 6 Jan 2013 15:07:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201301061507.r06F7KlT085111@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 6 Jan 2013 15:07:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r245103 - in stable/9/sys: fs/devfs kern sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jan 2013 15:07:20 -0000 Author: kib Date: Sun Jan 6 15:07:19 2013 New Revision: 245103 URL: http://svnweb.freebsd.org/changeset/base/245103 Log: MFC r244643: Do not force a writer to the devfs file to drain the buffer writes. Modified: stable/9/sys/fs/devfs/devfs_vnops.c stable/9/sys/kern/sys_generic.c stable/9/sys/sys/file.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/9/sys/fs/devfs/devfs_vnops.c Sun Jan 6 14:59:59 2013 (r245102) +++ stable/9/sys/fs/devfs/devfs_vnops.c Sun Jan 6 15:07:19 2013 (r245103) @@ -1049,6 +1049,7 @@ devfs_open(struct vop_open_args *ap) int error, ref, vlocked; struct cdevsw *dsw; struct file *fpop; + struct mtx *mtxp; if (vp->v_type == VBLK) return (ENXIO); @@ -1099,6 +1100,16 @@ devfs_open(struct vop_open_args *ap) #endif if (fp->f_ops == &badfileops) finit(fp, fp->f_flag, DTYPE_VNODE, dev, &devfs_ops_f); + mtxp = mtx_pool_find(mtxpool_sleep, fp); + + /* + * Hint to the dofilewrite() to not force the buffer draining + * on the writer to the file. Most likely, the write would + * not need normal buffers. + */ + mtx_lock(mtxp); + fp->f_vnread_flags |= FDEVFS_VNODE; + mtx_unlock(mtxp); return (error); } Modified: stable/9/sys/kern/sys_generic.c ============================================================================== --- stable/9/sys/kern/sys_generic.c Sun Jan 6 14:59:59 2013 (r245102) +++ stable/9/sys/kern/sys_generic.c Sun Jan 6 15:07:19 2013 (r245103) @@ -536,7 +536,8 @@ dofilewrite(td, fd, fp, auio, offset, fl ktruio = cloneuio(auio); #endif cnt = auio->uio_resid; - if (fp->f_type == DTYPE_VNODE) + if (fp->f_type == DTYPE_VNODE && + (fp->f_vnread_flags & FDEVFS_VNODE) == 0) bwillwrite(); if ((error = fo_write(fp, auio, td->td_ucred, flags, td))) { if (auio->uio_resid != cnt && (error == ERESTART || Modified: stable/9/sys/sys/file.h ============================================================================== --- stable/9/sys/sys/file.h Sun Jan 6 14:59:59 2013 (r245102) +++ stable/9/sys/sys/file.h Sun Jan 6 15:07:19 2013 (r245103) @@ -178,7 +178,8 @@ struct file { #define f_advice f_vnun.fvn_advice #define FOFFSET_LOCKED 0x1 -#define FOFFSET_LOCK_WAITING 0x2 +#define FOFFSET_LOCK_WAITING 0x2 +#define FDEVFS_VNODE 0x4 #endif /* _KERNEL || _WANT_FILE */