svn commit: r320075 - stable/11/sys/fs/cuse

Hans Petter Selasky hselasky at FreeBSD.org
Sun Jun 18 18:09:32 UTC 2017


Author: hselasky
Date: Sun Jun 18 18:09:31 2017
New Revision: 320075
URL: https://svnweb.freebsd.org/changeset/base/320075

Log:
  MFC r319355:
  Minor code optimisation.
  Avoid locking the global CUSE lock when the polling flags are zero.
  
  Approved by:	re (kib)

Modified:
  stable/11/sys/fs/cuse/cuse.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/cuse/cuse.c
==============================================================================
--- stable/11/sys/fs/cuse/cuse.c	Sun Jun 18 17:26:54 2017	(r320074)
+++ stable/11/sys/fs/cuse/cuse.c	Sun Jun 18 18:09:31 2017	(r320075)
@@ -1507,8 +1507,8 @@ cuse_client_kqfilter_poll(struct cdev *dev, struct cus
 		/* get the latest polling state from the server */
 		temp = cuse_client_poll(dev, POLLIN | POLLOUT, NULL);
 
-		cuse_lock();
 		if (temp & (POLLIN | POLLOUT)) {
+			cuse_lock();
 			if (temp & POLLIN)
 				pcc->cflags |= CUSE_CLI_KNOTE_NEED_READ;
 			if (temp & POLLOUT)
@@ -1516,8 +1516,8 @@ cuse_client_kqfilter_poll(struct cdev *dev, struct cus
 
 			/* make sure the "knote" gets woken up */
 			cuse_server_wakeup_locked(pcc->server);
+			cuse_unlock();
 		}
-		cuse_unlock();
 	}
 }
 


More information about the svn-src-stable mailing list