[rds-commits] zab commits r79 - trunk/linux/net/rds

svn-commits@oss.oracle.com svn-commits at oss.oracle.com
Thu May 25 19:35:27 CDT 2006


Author: zab
Date: 2006-05-25 19:35:25 -0500 (Thu, 25 May 2006)
New Revision: 79

Modified:
   trunk/linux/net/rds/af_rds.c
Log:
Add poll() support (mostly).


Modified: trunk/linux/net/rds/af_rds.c
===================================================================
--- trunk/linux/net/rds/af_rds.c	2006-05-26 00:31:37 UTC (rev 78)
+++ trunk/linux/net/rds/af_rds.c	2006-05-26 00:35:25 UTC (rev 79)
@@ -98,6 +98,31 @@
 	return 0;
 }
 
+/*
+ * RDS' poll is without a doubt the least coherent part of the interface.
+ * POLLIN reflects the state of the recv queue, sure.  POLLOUT is a lot more
+ * broken, though, as it represents the union of all the flows.  For now the
+ * spec is to always return POLLOUT and leave the app to discover if it's
+ * spinning getting POLLOUT and EAGAIN with non-blocking writes.  Awful.
+ */
+static unsigned int rds_poll(struct file *file, struct socket *sock,
+			     poll_table *wait)
+{
+	struct sock *sk = sock->sk;
+	struct rds_sock *rs = rds_sk_to_rs(sk);
+	unsigned int mask = 0;
+	unsigned long flags;
+
+	poll_wait(file, sk->sk_sleep, wait);
+
+	read_lock_irqsave(&sk->sk_callback_lock, flags);
+	if (!list_empty(&rs->rs_recv_queue))
+		mask |= POLLIN;
+	read_unlock_irqrestore(&sk->sk_callback_lock, flags);
+
+	return mask | POLLOUT | POLLWRNORM | POLLWRBAND;
+}
+
 static int rds_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 {
 #ifdef KERNEL_HAS_CORE_CALLING_DEV_IOCTL
@@ -198,7 +223,7 @@
 	.socketpair =	sock_no_socketpair,
 	.accept =	sock_no_accept,
 	.getname =	rds_getname,
-	.poll =		datagram_poll,
+	.poll =		rds_poll,
 	.ioctl =	rds_ioctl,
 	.listen =	sock_no_listen,
 	.shutdown =	sock_no_shutdown,




More information about the rds-commits mailing list