Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 198040
b: refs/heads/master
c: 21b667f
h: refs/heads/master
v: v3
  • Loading branch information
Sage Weil committed May 17, 2010
1 parent fbf4b5b commit e1e8643
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 45 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: 81a6cf2d30eac5d790f53cdff110892f7b18c7fe
refs/heads/master: 21b667f69b023979410188d7d94c9b219f216626
56 changes: 12 additions & 44 deletions trunk/fs/ceph/osd_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1087,45 +1087,6 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg)
return;
}


/*
* A read request prepares specific pages that data is to be read into.
* When a message is being read off the wire, we call prepare_pages to
* find those pages.
* 0 = success, -1 failure.
*/
static int __prepare_pages(struct ceph_connection *con,
struct ceph_msg_header *hdr,
struct ceph_osd_request *req,
u64 tid,
struct ceph_msg *m)
{
struct ceph_osd *osd = con->private;
struct ceph_osd_client *osdc;
int ret = -1;
int data_len = le32_to_cpu(hdr->data_len);
unsigned data_off = le16_to_cpu(hdr->data_off);

int want = calc_pages_for(data_off & ~PAGE_MASK, data_len);

if (!osd)
return -1;

osdc = osd->o_osdc;

dout("__prepare_pages on msg %p tid %llu, has %d pages, want %d\n", m,
tid, req->r_num_pages, want);
if (unlikely(req->r_num_pages < want))
goto out;
m->pages = req->r_pages;
m->nr_pages = req->r_num_pages;
ret = 0; /* success */
out:
BUG_ON(ret < 0 || m->nr_pages < want);

return ret;
}

/*
* Register request, send initial attempt.
*/
Expand Down Expand Up @@ -1394,7 +1355,8 @@ static void dispatch(struct ceph_connection *con, struct ceph_msg *msg)
}

/*
* lookup and return message for incoming reply
* lookup and return message for incoming reply. set up reply message
* pages.
*/
static struct ceph_msg *get_reply(struct ceph_connection *con,
struct ceph_msg_header *hdr,
Expand All @@ -1407,7 +1369,6 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
int front = le32_to_cpu(hdr->front_len);
int data_len = le32_to_cpu(hdr->data_len);
u64 tid;
int err;

tid = le64_to_cpu(hdr->tid);
mutex_lock(&osdc->request_mutex);
Expand Down Expand Up @@ -1439,12 +1400,19 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
m = ceph_msg_get(req->r_reply);

if (data_len > 0) {
err = __prepare_pages(con, hdr, req, tid, m);
if (err < 0) {
unsigned data_off = le16_to_cpu(hdr->data_off);
int want = calc_pages_for(data_off & ~PAGE_MASK, data_len);

if (unlikely(req->r_num_pages < want)) {
pr_warning("tid %lld reply %d > expected %d pages\n",
tid, want, m->nr_pages);
*skip = 1;
ceph_msg_put(m);
m = ERR_PTR(err);
m = ERR_PTR(-EIO);
goto out;
}
m->pages = req->r_pages;
m->nr_pages = req->r_num_pages;
}
*skip = 0;
req->r_con_filling_msg = ceph_con_get(con);
Expand Down

0 comments on commit e1e8643

Please sign in to comment.