summaryrefslogtreecommitdiff
path: root/net/ceph
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-11-15 00:12:48 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2016-12-26 21:35:38 -0500
commit100803a84d3cb84bd3ee36e8ec4274019ad667ac (patch)
tree15adbad3b7fe658dd971babc1876153ecb5113c3 /net/ceph
parent3995d1610713c1a62af687872e460c3dca82d17c (diff)
ceph: switch to sock_recvmsg()
... and use ITER_BVEC instead of playing with kmap() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/messenger.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 770c52701efa..9e46db7e5968 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -520,7 +520,8 @@ static int ceph_tcp_recvmsg(struct socket *sock, void *buf, size_t len)
struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL };
int r;
- r = kernel_recvmsg(sock, &msg, &iov, 1, len, msg.msg_flags);
+ iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &iov, 1, len);
+ r = sock_recvmsg(sock, &msg, msg.msg_flags);
if (r == -EAGAIN)
r = 0;
return r;
@@ -529,17 +530,20 @@ static int ceph_tcp_recvmsg(struct socket *sock, void *buf, size_t len)
static int ceph_tcp_recvpage(struct socket *sock, struct page *page,
int page_offset, size_t length)
{
- void *kaddr;
- int ret;
+ struct bio_vec bvec = {
+ .bv_page = page,
+ .bv_offset = page_offset,
+ .bv_len = length
+ };
+ struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL };
+ int r;
BUG_ON(page_offset + length > PAGE_SIZE);
-
- kaddr = kmap(page);
- BUG_ON(!kaddr);
- ret = ceph_tcp_recvmsg(sock, kaddr + page_offset, length);
- kunmap(page);
-
- return ret;
+ iov_iter_bvec(&msg.msg_iter, READ | ITER_BVEC, &bvec, 1, length);
+ r = sock_recvmsg(sock, &msg, msg.msg_flags);
+ if (r == -EAGAIN)
+ r = 0;
+ return r;
}
/*