Minor code optimisation.

Avoid locking the global CUSE lock when the polling flags are zero.

MFC after:	1 week
This commit is contained in:
Hans Petter Selasky 2017-05-31 21:05:24 +00:00
parent 6166fdcebc
commit 9a83b0971e

View File

@ -1507,8 +1507,8 @@ cuse_client_kqfilter_poll(struct cdev *dev, struct cuse_client *pcc)
/* 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 cuse_client *pcc)
/* make sure the "knote" gets woken up */
cuse_server_wakeup_locked(pcc->server);
cuse_unlock();
}
cuse_unlock();
}
}