Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 373381
b: refs/heads/master
c: 686be20
h: refs/heads/master
i:
  373379: b65c07d
v: v3
  • Loading branch information
Alex Elder authored and Sage Weil committed May 2, 2013
1 parent b65c8df commit c1ca030
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 63 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 61fcdc97c06bce7b6d16dd2a6b478f24cd121d96
refs/heads/master: 686be20875db63c6103573565c63db20153ee6e1
80 changes: 18 additions & 62 deletions trunk/net/ceph/messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -2185,87 +2185,41 @@ static int read_partial_message_section(struct ceph_connection *con,
return 1;
}

static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip);

static int read_partial_message_pages(struct ceph_connection *con,
unsigned int data_len, bool do_datacrc)
{
struct ceph_msg *msg = con->in_msg;
struct page *page;
size_t page_offset;
size_t length;
int ret;

page = ceph_msg_data_next(&msg->p, &page_offset, &length, NULL);

ret = ceph_tcp_recvpage(con->sock, page, page_offset, length);
if (ret <= 0)
return ret;

if (do_datacrc)
con->in_data_crc = ceph_crc32c_page(con->in_data_crc, page,
page_offset, ret);

in_msg_pos_next(con, length, ret);

return ret;
}

#ifdef CONFIG_BLOCK
static int read_partial_message_bio(struct ceph_connection *con,
unsigned int data_len, bool do_datacrc)
{
struct ceph_msg *msg = con->in_msg;
struct page *page;
size_t page_offset;
size_t length;
int ret;

BUG_ON(!msg);

page = ceph_msg_data_next(&msg->b, &page_offset, &length, NULL);

ret = ceph_tcp_recvpage(con->sock, page, page_offset, length);
if (ret <= 0)
return ret;

if (do_datacrc)
con->in_data_crc = ceph_crc32c_page(con->in_data_crc, page,
page_offset, ret);

in_msg_pos_next(con, length, ret);

return ret;
}
#endif

static int read_partial_msg_data(struct ceph_connection *con)
{
struct ceph_msg *msg = con->in_msg;
struct ceph_msg_pos *msg_pos = &con->in_msg_pos;
const bool do_datacrc = !con->msgr->nocrc;
unsigned int data_len;
struct page *page;
size_t page_offset;
size_t length;
int ret;

BUG_ON(!msg);

data_len = le32_to_cpu(con->in_hdr.data_len);
while (msg_pos->data_pos < data_len) {
if (ceph_msg_has_pages(msg)) {
ret = read_partial_message_pages(con, data_len,
do_datacrc);
if (ret <= 0)
return ret;
page = ceph_msg_data_next(&msg->p, &page_offset,
&length, NULL);
#ifdef CONFIG_BLOCK
} else if (ceph_msg_has_bio(msg)) {
ret = read_partial_message_bio(con,
data_len, do_datacrc);
if (ret <= 0)
return ret;
page = ceph_msg_data_next(&msg->b, &page_offset,
&length, NULL);
#endif
} else {
BUG_ON(1);
}
ret = ceph_tcp_recvpage(con->sock, page, page_offset, length);
if (ret <= 0)
return ret;

if (do_datacrc)
con->in_data_crc = ceph_crc32c_page(con->in_data_crc,
page, page_offset, ret);

in_msg_pos_next(con, length, ret);
}

return 1; /* must return > 0 to indicate success */
Expand All @@ -2274,6 +2228,8 @@ static int read_partial_msg_data(struct ceph_connection *con)
/*
* read (part of) a message.
*/
static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip);

static int read_partial_message(struct ceph_connection *con)
{
struct ceph_msg *m = con->in_msg;
Expand Down

0 comments on commit c1ca030

Please sign in to comment.