svn commit: r319355 - head/sys/fs/cuse

Hans Petter Selasky hselasky at FreeBSD.org
Wed May 31 21:05:25 UTC 2017


Author: hselasky
Date: Wed May 31 21:05:24 2017
New Revision: 319355
URL: https://svnweb.freebsd.org/changeset/base/319355

Log:
  Minor code optimisation.
  Avoid locking the global CUSE lock when the polling flags are zero.
  
  MFC after:	1 week

Modified:
  head/sys/fs/cuse/cuse.c

Modified: head/sys/fs/cuse/cuse.c
==============================================================================
--- head/sys/fs/cuse/cuse.c	Wed May 31 19:37:23 2017	(r319354)
+++ head/sys/fs/cuse/cuse.c	Wed May 31 21:05:24 2017	(r319355)
@@ -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-head mailing list