On Tue, Jun 26, 2012 at 04:45:39PM +0800, Liu Yuan wrote: > From: Liu Yuan <tailai.ly at taobao.com> > > This is inspired by the observation that each Guest can issue as much > as 4 requests in one go. > > The complexity added to the code is seen outside of sockfd cache: > add one more parameter to the API: FD index. The underlying core needs this to > identify which FD belongs one node is actually used. > > I think this trade-off is a good deal. I think so to. > - fd = sheep_get_fd(v); > + fd = sheep_get_fd(v, &sock_idx); > if (fd < 0) { > + sheep_del_fd(v, fd, sock_idx); I think APIs that expect to be passed multiple related but not grouped arguments are a desaster waiting to happen. I'd probably pass what's the struct write_info_ent I suggested in the last patch here. While the pfd argument isn't need for reads I'd rather trade a little more stack usage for a much more coherent interface. Also I suspect instead of just returning the index I'd suggest returning the actual pointer to the sockfd_cache_entry as well, to avoid having to do another lookup and lock roundtrip when dropping the reference. |