forked from beagleboard/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PATCH] RPC: introduce client-side transport switch
Move the bulk of client-side socket-specific code into a separate source file, net/sunrpc/xprtsock.c. Test-plan: Millions of fsx operations. Performance characterization such as "sio" or "iozone". Destructive testing (unplugging the network temporarily, server reboots). Connectathon with v2, v3, and v4. Version: Thu, 11 Aug 2005 16:03:38 -0400 Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
- Loading branch information
Chuck Lever
authored and
Trond Myklebust
committed
Sep 23, 2005
1 parent
094bb20
commit a246b01
Showing
8 changed files
with
1,101 additions
and
989 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,15 +6,12 @@ | |
* Copyright (C) 1995, 1996 Olaf Kirch <[email protected]> | ||
*/ | ||
|
||
#include <linux/module.h> | ||
#include <linux/types.h> | ||
#include <linux/socket.h> | ||
#include <linux/string.h> | ||
#include <linux/kernel.h> | ||
#include <linux/pagemap.h> | ||
#include <linux/errno.h> | ||
#include <linux/in.h> | ||
#include <linux/net.h> | ||
#include <net/sock.h> | ||
#include <linux/sunrpc/xdr.h> | ||
#include <linux/sunrpc/msg_prot.h> | ||
|
||
|
@@ -177,103 +174,6 @@ xdr_inline_pages(struct xdr_buf *xdr, unsigned int offset, | |
} | ||
|
||
|
||
int | ||
xdr_sendpages(struct socket *sock, struct sockaddr *addr, int addrlen, | ||
struct xdr_buf *xdr, unsigned int base, int msgflags) | ||
{ | ||
struct page **ppage = xdr->pages; | ||
unsigned int len, pglen = xdr->page_len; | ||
int err, ret = 0; | ||
ssize_t (*sendpage)(struct socket *, struct page *, int, size_t, int); | ||
|
||
len = xdr->head[0].iov_len; | ||
if (base < len || (addr != NULL && base == 0)) { | ||
struct kvec iov = { | ||
.iov_base = xdr->head[0].iov_base + base, | ||
.iov_len = len - base, | ||
}; | ||
struct msghdr msg = { | ||
.msg_name = addr, | ||
.msg_namelen = addrlen, | ||
.msg_flags = msgflags, | ||
}; | ||
if (xdr->len > len) | ||
msg.msg_flags |= MSG_MORE; | ||
|
||
if (iov.iov_len != 0) | ||
err = kernel_sendmsg(sock, &msg, &iov, 1, iov.iov_len); | ||
else | ||
err = kernel_sendmsg(sock, &msg, NULL, 0, 0); | ||
if (ret == 0) | ||
ret = err; | ||
else if (err > 0) | ||
ret += err; | ||
if (err != iov.iov_len) | ||
goto out; | ||
base = 0; | ||
} else | ||
base -= len; | ||
|
||
if (pglen == 0) | ||
goto copy_tail; | ||
if (base >= pglen) { | ||
base -= pglen; | ||
goto copy_tail; | ||
} | ||
if (base || xdr->page_base) { | ||
pglen -= base; | ||
base += xdr->page_base; | ||
ppage += base >> PAGE_CACHE_SHIFT; | ||
base &= ~PAGE_CACHE_MASK; | ||
} | ||
|
||
sendpage = sock->ops->sendpage ? : sock_no_sendpage; | ||
do { | ||
int flags = msgflags; | ||
|
||
len = PAGE_CACHE_SIZE; | ||
if (base) | ||
len -= base; | ||
if (pglen < len) | ||
len = pglen; | ||
|
||
if (pglen != len || xdr->tail[0].iov_len != 0) | ||
flags |= MSG_MORE; | ||
|
||
/* Hmm... We might be dealing with highmem pages */ | ||
if (PageHighMem(*ppage)) | ||
sendpage = sock_no_sendpage; | ||
err = sendpage(sock, *ppage, base, len, flags); | ||
if (ret == 0) | ||
ret = err; | ||
else if (err > 0) | ||
ret += err; | ||
if (err != len) | ||
goto out; | ||
base = 0; | ||
ppage++; | ||
} while ((pglen -= len) != 0); | ||
copy_tail: | ||
len = xdr->tail[0].iov_len; | ||
if (base < len) { | ||
struct kvec iov = { | ||
.iov_base = xdr->tail[0].iov_base + base, | ||
.iov_len = len - base, | ||
}; | ||
struct msghdr msg = { | ||
.msg_flags = msgflags, | ||
}; | ||
err = kernel_sendmsg(sock, &msg, &iov, 1, iov.iov_len); | ||
if (ret == 0) | ||
ret = err; | ||
else if (err > 0) | ||
ret += err; | ||
} | ||
out: | ||
return ret; | ||
} | ||
|
||
|
||
/* | ||
* Helper routines for doing 'memmove' like operations on a struct xdr_buf | ||
* | ||
|
Oops, something went wrong.