summaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-02-25 19:11:12 -0500
committerSage Weil <sage@inktank.com>2013-02-26 18:02:50 -0500
commit1b83bef24c6746a146d39915a18fb5425f2facb0 (patch)
treea765aeb136f4c7e354c01314e5fdfb776d503fb7 /fs/ceph
parent2169aea649c08374bec7d220a3b8f64712275356 (diff)
libceph: update osd request/reply encoding
Use the new version of the encoding for osd requests and replies. In the process, update the way we are tracking request ops and reply lengths and results in the struct ceph_osd_request. Update the rbd and fs/ceph users appropriately. The main changes are: - we keep pointers into the request memory for fields we need to update each time the request is sent out over the wire - we keep information about the result in an array in the request struct where the users can easily get at it. Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Alex Elder <elder@inktank.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/addr.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index fc613715af46..cfef3e01a9b3 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -236,16 +236,10 @@ static int ceph_readpage(struct file *filp, struct page *page)
236static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg) 236static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)
237{ 237{
238 struct inode *inode = req->r_inode; 238 struct inode *inode = req->r_inode;
239 struct ceph_osd_reply_head *replyhead; 239 int rc = req->r_result;
240 int rc, bytes; 240 int bytes = le32_to_cpu(msg->hdr.data_len);
241 int i; 241 int i;
242 242
243 /* parse reply */
244 replyhead = msg->front.iov_base;
245 WARN_ON(le32_to_cpu(replyhead->num_ops) == 0);
246 rc = le32_to_cpu(replyhead->result);
247 bytes = le32_to_cpu(msg->hdr.data_len);
248
249 dout("finish_read %p req %p rc %d bytes %d\n", inode, req, rc, bytes); 243 dout("finish_read %p req %p rc %d bytes %d\n", inode, req, rc, bytes);
250 244
251 /* unlock all pages, zeroing any data we didn't read */ 245 /* unlock all pages, zeroing any data we didn't read */
@@ -553,27 +547,18 @@ static void writepages_finish(struct ceph_osd_request *req,
553 struct ceph_msg *msg) 547 struct ceph_msg *msg)
554{ 548{
555 struct inode *inode = req->r_inode; 549 struct inode *inode = req->r_inode;
556 struct ceph_osd_reply_head *replyhead;
557 struct ceph_osd_op *op;
558 struct ceph_inode_info *ci = ceph_inode(inode); 550 struct ceph_inode_info *ci = ceph_inode(inode);
559 unsigned wrote; 551 unsigned wrote;
560 struct page *page; 552 struct page *page;
561 int i; 553 int i;
562 struct ceph_snap_context *snapc = req->r_snapc; 554 struct ceph_snap_context *snapc = req->r_snapc;
563 struct address_space *mapping = inode->i_mapping; 555 struct address_space *mapping = inode->i_mapping;
564 __s32 rc = -EIO; 556 int rc = req->r_result;
565 u64 bytes = 0; 557 u64 bytes = le64_to_cpu(req->r_request_ops[0].extent.length);
566 struct ceph_fs_client *fsc = ceph_inode_to_client(inode); 558 struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
567 long writeback_stat; 559 long writeback_stat;
568 unsigned issued = ceph_caps_issued(ci); 560 unsigned issued = ceph_caps_issued(ci);
569 561
570 /* parse reply */
571 replyhead = msg->front.iov_base;
572 WARN_ON(le32_to_cpu(replyhead->num_ops) == 0);
573 op = (void *)(replyhead + 1);
574 rc = le32_to_cpu(replyhead->result);
575 bytes = le64_to_cpu(op->extent.length);
576
577 if (rc >= 0) { 562 if (rc >= 0) {
578 /* 563 /*
579 * Assume we wrote the pages we originally sent. The 564 * Assume we wrote the pages we originally sent. The
@@ -740,8 +725,6 @@ retry:
740 struct page *page; 725 struct page *page;
741 int want; 726 int want;
742 u64 offset, len; 727 u64 offset, len;
743 struct ceph_osd_request_head *reqhead;
744 struct ceph_osd_op *op;
745 long writeback_stat; 728 long writeback_stat;
746 729
747 next = 0; 730 next = 0;
@@ -905,10 +888,8 @@ get_more_pages:
905 888
906 /* revise final length, page count */ 889 /* revise final length, page count */
907 req->r_num_pages = locked_pages; 890 req->r_num_pages = locked_pages;
908 reqhead = req->r_request->front.iov_base; 891 req->r_request_ops[0].extent.length = cpu_to_le64(len);
909 op = (void *)(reqhead + 1); 892 req->r_request_ops[0].payload_len = cpu_to_le32(len);
910 op->extent.length = cpu_to_le64(len);
911 op->payload_len = cpu_to_le32(len);
912 req->r_request->hdr.data_len = cpu_to_le32(len); 893 req->r_request->hdr.data_len = cpu_to_le32(len);
913 894
914 rc = ceph_osdc_start_request(&fsc->client->osdc, req, true); 895 rc = ceph_osdc_start_request(&fsc->client->osdc, req, true);