Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 May 2017 21:05:24 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r319355 - head/sys/fs/cuse
Message-ID:  <201705312105.v4VL5OjI044117@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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();
 	}
 }
 



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