]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ocfs2: don't open-code kernel_sendmsg()
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 8 Feb 2014 18:27:03 +0000 (13:27 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 2 Apr 2014 03:19:30 +0000 (23:19 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/ocfs2/cluster/tcp.c

index 2cd2406b41408b61dc0797e2e87e6f29a84506e0..68d80c3163817ce7578135b45e4aa81e11627bce 100644 (file)
@@ -940,33 +940,21 @@ static int o2net_send_tcp_msg(struct socket *sock, struct kvec *vec,
                              size_t veclen, size_t total)
 {
        int ret;
-       mm_segment_t oldfs;
-       struct msghdr msg = {
-               .msg_iov = (struct iovec *)vec,
-               .msg_iovlen = veclen,
-       };
+       struct msghdr msg;
 
        if (sock == NULL) {
                ret = -EINVAL;
                goto out;
        }
 
-       oldfs = get_fs();
-       set_fs(get_ds());
-       ret = sock_sendmsg(sock, &msg, total);
-       set_fs(oldfs);
-       if (ret != total) {
-               mlog(ML_ERROR, "sendmsg returned %d instead of %zu\n", ret,
-                    total);
-               if (ret >= 0)
-                       ret = -EPIPE; /* should be smarter, I bet */
-               goto out;
-       }
-
-       ret = 0;
+       ret = kernel_sendmsg(sock, &msg, vec, veclen, total);
+       if (likely(ret == total))
+               return 0;
+       mlog(ML_ERROR, "sendmsg returned %d instead of %zu\n", ret, total);
+       if (ret >= 0)
+               ret = -EPIPE; /* should be smarter, I bet */
 out:
-       if (ret < 0)
-               mlog(0, "returning error: %d\n", ret);
+       mlog(0, "returning error: %d\n", ret);
        return ret;
 }