[PATCH] fs: select: Refine the end_time checks in do_select

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Gao Feng <gfree.wind@xxxxxxxxxxx>

Refine the end_time condition check statements to decrease the unncessary
checks and enhance the readability.

Signed-off-by: Gao Feng <gfree.wind@xxxxxxxxxxx>
---
 fs/select.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/fs/select.c b/fs/select.c
index d6c652a..34257dd 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -468,13 +468,15 @@ static int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time)
 
 	poll_initwait(&table);
 	wait = &table.pt;
-	if (end_time && !end_time->tv_sec && !end_time->tv_nsec) {
-		wait->_qproc = NULL;
-		timed_out = 1;
-	}
 
-	if (end_time && !timed_out)
-		slack = select_estimate_accuracy(end_time);
+	if (end_time) {
+		if (end_time->tv_sec || end_time->tv_nsec) {
+			slack = select_estimate_accuracy(end_time);
+		} else {
+			wait->_qproc = NULL;
+			timed_out = 1;
+		}
+	}
 
 	retval = 0;
 	for (;;) {
-- 
1.9.1





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux