Re: [PATCH] zerocopy NFS updated

Hirokazu Takahashi (taka@valinux.co.jp)
Tue, 16 Apr 2002 10:03:02 +0900 (JST)


Hi, David

Thank you for your advice!

davem> Sendpages mechanism will not be implemented.
davem>
davem> You must implement UDP sendfile() one page at a time, by building up
davem> an SKB with multiple calls similar to TCP with TCP_CORK socket option
davem> set.
davem>
davem> For datagram sockets, define temporary SKB hung off of struct sock.
davem> Define UDP_CORK socket option which begins the "queue data only"
davem> state.
davem>
davem> All sendmsg()/sendfile() calls append to temporary SKB, first
davem> sendmsg()/sendfile() call to UDP will create this sock->skb. First
davem> call may be sendmsg() but subsequent calls for that SKB must be
davem> sendfile() calls. If this pattern of calls is broken, SKB is sent.
davem>
davem> Call to set UDP_CORK socket option to zero actually sends the SKB
davem> being built.
davem>
davem> The normal usage will be:
davem>
davem> setsockopt(fd, UDP_CORK, 1);
davem> sendmsg(fd, sunrpc_headers, sizeof(sunrpc_headers));
davem> sendfile(fd, ...);
davem> setsockopt(fd, UDP_CORK, 0);

Yes, it seems to be the most general way.
OK, I'll do this way first of all.

In the kernel, probaboly I'd impelement as following:

put a RPC header and a NFS header on "bufferA";
down(semaphore);
sendmsg(bufferA, MSG_MORE);
for (eache pages of fileC)
sock->opt->sendpage(page, islastpage ? 0 : MSG_MORE)
up(semaphore);

the semaphore is required to serialize sending data as many knfsd kthreads
use the same socket.

Actually I'd like to implement it like following codes, but unfortunatelly
it wouldn't work on UDP socket of servers as the socket doesn't have specific
destination address at all, and sendpage has no arguments to specify it.
It's not so good....

put a RPC header and a NFS header on "pageB";
down(semaphore);
sock->opt->sendpage(pageB, MSG_MORE);
for (each pages of fileC)
sock->opt->sendpage(page, islastpage ? 0 : MSG_MORE)
up(semaphore);

Thank you,
Hirokazu Takahashi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/