diff options
author | Alex Elder <elder@inktank.com> | 2013-03-12 04:34:23 (GMT) |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-02 04:17:27 (GMT) |
commit | 878efabd3236abaedd0a4539bbb248ac69fed115 (patch) | |
tree | cbd6e9f6af2f756a26631e36e868fc4c5189992b /net | |
parent | 6518be47f910f62a98cb6044dbb457af55241f95 (diff) | |
download | linux-fsl-qoriq-878efabd3236abaedd0a4539bbb248ac69fed115.tar.xz |
libceph: use cursor for inbound data pages
The cursor code for a page array selects the right page, page
offset, and length to use for a ceph_tcp_recvpage() call, so
we can use it to replace a block in read_partial_message_pages().
This partially resolves:
http://tracker.ceph.com/issues/4428
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/ceph/messenger.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index b634d20..f81fbce 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -1441,8 +1441,10 @@ static void in_msg_pos_next(struct ceph_connection *con, size_t len, msg_pos->data_pos += received; msg_pos->page_pos += received; + if (ceph_msg_has_pages(msg)) + (void) ceph_msg_data_advance(&msg->p, received); #ifdef CONFIG_BLOCK - if (ceph_msg_has_bio(msg)) + else if (ceph_msg_has_bio(msg)) (void) ceph_msg_data_advance(&msg->b, received); #endif /* CONFIG_BLOCK */ if (received < len) @@ -2192,23 +2194,12 @@ 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 ceph_msg_pos *msg_pos = &con->in_msg_pos; - struct page **pages; struct page *page; size_t page_offset; size_t length; - unsigned int left; int ret; - /* (page) data */ - pages = msg->p.pages; - BUG_ON(pages == NULL); - page = pages[msg_pos->page]; - page_offset = msg_pos->page_pos; - BUG_ON(msg_pos->data_pos >= data_len); - left = data_len - msg_pos->data_pos; - BUG_ON(page_offset >= PAGE_SIZE); - length = min_t(unsigned int, PAGE_SIZE - page_offset, left); + page = ceph_msg_data_next(&msg->p, &page_offset, &length, NULL); ret = ceph_tcp_recvpage(con->sock, page, page_offset, length); if (ret <= 0) |