]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: use both writepage and crc
authorYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 7 Oct 2008 18:25:09 +0000 (11:25 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 7 Oct 2008 18:25:09 +0000 (11:25 -0700)
src/kernel/messenger.c

index bb079948ec9d85c1ca2e28ba574efc1605241f88..acbb9e7849e66ed6a28937ef026e8fd3d4aa39e6 100644 (file)
@@ -18,7 +18,7 @@ int ceph_debug_msgr;
 #include "super.h"
 
 
-#undef CEPH_USE_SENDPAGE
+#define CEPH_USE_SENDPAGE
 
 /* static tag bytes */
 static char tag_ready = CEPH_MSGR_TAG_READY;
@@ -676,11 +676,7 @@ out:
 static int write_partial_msg_pages(struct ceph_connection *con,
                                   struct ceph_msg *msg)
 {
-#ifndef CEPH_USE_SENDPAGE
        struct kvec kv;
-#else
-       int len;
-#endif
        int ret;
        unsigned data_len = le32_to_cpu(msg->hdr.data_len);
 
@@ -690,23 +686,16 @@ static int write_partial_msg_pages(struct ceph_connection *con,
 
        while (con->out_msg_pos.page < con->out_msg->nr_pages) {
                struct page *page = NULL;
-#ifndef CEPH_USE_SENDPAGE
                void *kaddr;
-#endif
 
                mutex_lock(&msg->page_mutex);
                if (msg->pages) {
                        page = msg->pages[con->out_msg_pos.page];
-#ifndef CEPH_USE_SENDPAGE
                        kaddr = kmap(page);
-#endif
                } else {
-#ifndef CEPH_USE_SENDPAGE
                        /*dout(60, "using zero page\n");*/
                        kaddr = page_address(con->msgr->zero_page);
-#endif
                }
-#ifndef CEPH_USE_SENDPAGE
                kv.iov_base = kaddr + con->out_msg_pos.page_pos;
                kv.iov_len = min((int)(PAGE_SIZE - con->out_msg_pos.page_pos),
                                 (int)(data_len - con->out_msg_pos.data_pos));
@@ -716,36 +705,26 @@ static int write_partial_msg_pages(struct ceph_connection *con,
                                          kv.iov_base, kv.iov_len);
                        con->out_msg_pos.did_page_crc = 1;
                }
-#else
-               len = min((int)(PAGE_SIZE - con->out_msg_pos.page_pos),
-                               (int)(data_len - con->out_msg_pos.data_pos));
-
-               con->out_msg_pos.did_page_crc = 0;
-#endif
 
 #ifndef CEPH_USE_SENDPAGE
                ret = ceph_tcp_sendmsg(con->sock, &kv, 1, kv.iov_len, 1);
 #else
                if (msg->pages)
-                       ret = kernel_sendpage(con->sock, page, con->out_msg_pos.page_pos, len, MSG_DONTWAIT | MSG_NOSIGNAL | MSG_MORE);
+                       ret = kernel_sendpage(con->sock, page, con->out_msg_pos.page_pos, kv.iov_len, MSG_DONTWAIT | MSG_NOSIGNAL | MSG_MORE);
                else
-                       ret = kernel_sendpage(con->sock, con->msgr->zero_page, con->out_msg_pos.page_pos, len, MSG_DONTWAIT | MSG_NOSIGNAL | MSG_MORE);
+                       ret = kernel_sendpage(con->sock, con->msgr->zero_page, con->out_msg_pos.page_pos, kv.iov_len, MSG_DONTWAIT | MSG_NOSIGNAL | MSG_MORE);
 #endif
 
-#ifndef CEPH_USE_SENDPAGE
                if (msg->pages)
                        kunmap(page);
-#endif
+
                mutex_unlock(&msg->page_mutex);
                if (ret <= 0)
                        goto out;
                con->out_msg_pos.data_pos += ret;
                con->out_msg_pos.page_pos += ret;
-#ifndef CEPH_USE_SENDPAGE
+
                if (ret == kv.iov_len) {
-#else
-               if (ret == len) {
-#endif
                        con->out_msg_pos.page_pos = 0;
                        con->out_msg_pos.page++;
                        con->out_msg_pos.did_page_crc = 0;