Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Oct 2019 17:44:33 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r353126 - in head/sys: fs/devfs kern sys
Message-ID:  <201910051744.x95HiXWY074508@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Sat Oct  5 17:44:33 2019
New Revision: 353126
URL: https://svnweb.freebsd.org/changeset/base/353126

Log:
  devfs: plug redundant bwillwrite avoidance
  
  vn_write already checks for vnode type to see if bwillwrite should be called.
  
  This effectively reverts r244643.
  
  Reviewed by:	kib
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21905

Modified:
  head/sys/fs/devfs/devfs_vnops.c
  head/sys/kern/sys_generic.c
  head/sys/sys/file.h

Modified: head/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- head/sys/fs/devfs/devfs_vnops.c	Sat Oct  5 17:36:33 2019	(r353125)
+++ head/sys/fs/devfs/devfs_vnops.c	Sat Oct  5 17:44:33 2019	(r353126)
@@ -1137,7 +1137,6 @@ 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);
@@ -1191,16 +1190,6 @@ 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: head/sys/kern/sys_generic.c
==============================================================================
--- head/sys/kern/sys_generic.c	Sat Oct  5 17:36:33 2019	(r353125)
+++ head/sys/kern/sys_generic.c	Sat Oct  5 17:44:33 2019	(r353126)
@@ -561,9 +561,6 @@ dofilewrite(struct thread *td, int fd, struct file *fp
 		ktruio = cloneuio(auio);
 #endif
 	cnt = auio->uio_resid;
-	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 ||
 		    error == EINTR || error == EWOULDBLOCK))

Modified: head/sys/sys/file.h
==============================================================================
--- head/sys/sys/file.h	Sat Oct  5 17:36:33 2019	(r353125)
+++ head/sys/sys/file.h	Sat Oct  5 17:44:33 2019	(r353126)
@@ -208,7 +208,6 @@ struct file {
 
 #define	FOFFSET_LOCKED       0x1
 #define	FOFFSET_LOCK_WAITING 0x2
-#define	FDEVFS_VNODE	     0x4
 
 #endif /* _KERNEL || _WANT_FILE */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910051744.x95HiXWY074508>