Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 373422
b: refs/heads/master
c: 8c042b0
h: refs/heads/master
v: v3
  • Loading branch information
Alex Elder authored and Sage Weil committed May 2, 2013
1 parent 229c766 commit fd5c1a7
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 11 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: 54d5064912649e296552f298e6472ffd37cd8f90
refs/heads/master: 8c042b0df99cd06ef8473ef6e204b87b3dc80158
24 changes: 20 additions & 4 deletions trunk/drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1315,23 +1315,39 @@ static void rbd_osd_req_format_op(struct rbd_obj_request *obj_request,
bool write_request)
{
struct rbd_img_request *img_request = obj_request->img_request;
struct ceph_osd_request *osd_req = obj_request->osd_req;
struct ceph_osd_data *osd_data = NULL;
struct ceph_snap_context *snapc = NULL;
u64 snap_id = CEPH_NOSNAP;
struct timespec *mtime = NULL;
struct timespec now;

rbd_assert(obj_request->osd_req != NULL);
rbd_assert(osd_req != NULL);

if (write_request) {
osd_data = &osd_req->r_data_out;
now = CURRENT_TIME;
mtime = &now;
if (img_request)
snapc = img_request->snapc;
} else if (img_request) {
snap_id = img_request->snap_id;
} else {
osd_data = &osd_req->r_data_in;
if (img_request)
snap_id = img_request->snap_id;
}
if (obj_request->type != OBJ_REQUEST_NODATA) {
struct ceph_osd_req_op *op = &obj_request->osd_req->r_ops[0];

ceph_osdc_build_request(obj_request->osd_req, obj_request->offset,
/*
* If it has data, it's either a object class method
* call (cls) or it's an extent operation.
*/
if (op->op == CEPH_OSD_OP_CALL)
osd_req_op_cls_response_data(op, osd_data);
else
osd_req_op_extent_osd_data(op, osd_data);
}
ceph_osdc_build_request(osd_req, obj_request->offset,
snapc, snap_id, mtime);
}

Expand Down
8 changes: 5 additions & 3 deletions trunk/fs/ceph/addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max)
}
pages[i] = page;
}
ceph_osd_data_pages_init(&req->r_data_in, pages, len, 0,
BUG_ON(req->r_ops[0].extent.osd_data != &req->r_data_in);
ceph_osd_data_pages_init(req->r_ops[0].extent.osd_data, pages, len, 0,
false, false);
req->r_callback = finish_read;
req->r_inode = inode;
Expand Down Expand Up @@ -916,8 +917,9 @@ static int ceph_writepages_start(struct address_space *mapping,
dout("writepages got %d pages at %llu~%llu\n",
locked_pages, offset, len);

ceph_osd_data_pages_init(&req->r_data_out, pages, len, 0,
!!pool, false);
BUG_ON(req->r_ops[0].extent.osd_data != &req->r_data_out);
ceph_osd_data_pages_init(req->r_ops[0].extent.osd_data, pages,
len, 0, !!pool, false);

pages = NULL; /* request message now owns the pages array */
pool = NULL;
Expand Down
5 changes: 3 additions & 2 deletions trunk/fs/ceph/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,9 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data,
own_pages = true;
}
}
ceph_osd_data_pages_init(&req->r_data_out, pages, len, page_align,
false, own_pages);
BUG_ON(req->r_ops[0].extent.osd_data != &req->r_data_out);
ceph_osd_data_pages_init(req->r_ops[0].extent.osd_data, pages, len,
page_align, false, own_pages);

/* BUG_ON(vino.snap != CEPH_NOSNAP); */
ceph_osdc_build_request(req, pos, snapc, vino.snap, &mtime);
Expand Down
6 changes: 6 additions & 0 deletions trunk/include/linux/ceph/osd_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,14 @@ struct ceph_osd_req_op {
u64 offset, length;
u64 truncate_size;
u32 truncate_seq;
struct ceph_osd_data *osd_data;
} extent;
struct {
const char *class_name;
const char *method_name;
const void *request_data;
u32 request_data_len;
struct ceph_osd_data *response_data;
__u8 class_len;
__u8 method_len;
__u8 argc;
Expand Down Expand Up @@ -236,10 +238,14 @@ extern void osd_req_op_extent_init(struct ceph_osd_req_op *op, u16 opcode,
u64 offset, u64 length,
u64 truncate_size, u32 truncate_seq);
extern void osd_req_op_extent_update(struct ceph_osd_req_op *op, u64 length);
extern void osd_req_op_extent_osd_data(struct ceph_osd_req_op *op,
struct ceph_osd_data *osd_data);
extern void osd_req_op_cls_init(struct ceph_osd_req_op *op, u16 opcode,
const char *class, const char *method,
const void *request_data,
size_t request_data_size);
extern void osd_req_op_cls_response_data(struct ceph_osd_req_op *op,
struct ceph_osd_data *response_data);
extern void osd_req_op_watch_init(struct ceph_osd_req_op *op, u16 opcode,
u64 cookie, u64 version, int flag);

Expand Down
26 changes: 25 additions & 1 deletion trunk/net/ceph/osd_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,13 @@ void osd_req_op_extent_update(struct ceph_osd_req_op *op, u64 length)
}
EXPORT_SYMBOL(osd_req_op_extent_update);

void osd_req_op_extent_osd_data(struct ceph_osd_req_op *op,
struct ceph_osd_data *osd_data)
{
op->extent.osd_data = osd_data;
}
EXPORT_SYMBOL(osd_req_op_extent_osd_data);

void osd_req_op_cls_init(struct ceph_osd_req_op *op, u16 opcode,
const char *class, const char *method,
const void *request_data, size_t request_data_size)
Expand Down Expand Up @@ -406,6 +413,13 @@ void osd_req_op_cls_init(struct ceph_osd_req_op *op, u16 opcode,
}
EXPORT_SYMBOL(osd_req_op_cls_init);

void osd_req_op_cls_response_data(struct ceph_osd_req_op *op,
struct ceph_osd_data *response_data)
{
op->cls.response_data = response_data;
}
EXPORT_SYMBOL(osd_req_op_cls_response_data);

void osd_req_op_watch_init(struct ceph_osd_req_op *op, u16 opcode,
u64 cookie, u64 version, int flag)
{
Expand Down Expand Up @@ -449,6 +463,10 @@ static u64 osd_req_encode_op(struct ceph_osd_request *req,
cpu_to_le64(src->extent.truncate_size);
dst->extent.truncate_seq =
cpu_to_le32(src->extent.truncate_seq);
if (src->op == CEPH_OSD_OP_WRITE)
WARN_ON(src->extent.osd_data != &req->r_data_out);
else
WARN_ON(src->extent.osd_data != &req->r_data_in);
break;
case CEPH_OSD_OP_CALL:
pagelist = kmalloc(sizeof (*pagelist), GFP_NOFS);
Expand All @@ -464,8 +482,9 @@ static u64 osd_req_encode_op(struct ceph_osd_request *req,
src->cls.method_len);
ceph_pagelist_append(pagelist, src->cls.request_data,
src->cls.request_data_len);

ceph_osd_data_pagelist_init(&req->r_data_out, pagelist);

WARN_ON(src->cls.response_data != &req->r_data_in);
request_data_len = pagelist->length;
break;
case CEPH_OSD_OP_STARTSYNC:
Expand Down Expand Up @@ -609,6 +628,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
bool use_mempool)
{
struct ceph_osd_request *req;
struct ceph_osd_data *osd_data;
struct ceph_osd_req_op *op;
u64 objnum = 0;
u64 objoff = 0;
Expand All @@ -623,6 +643,8 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
GFP_NOFS);
if (!req)
return ERR_PTR(-ENOMEM);
osd_data = opcode == CEPH_OSD_OP_WRITE ? &req->r_data_out
: &req->r_data_in;

req->r_flags = flags;

Expand All @@ -646,6 +668,8 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
op = &req->r_ops[0];
osd_req_op_extent_init(op, opcode, objoff, objlen,
truncate_size, truncate_seq);
osd_req_op_extent_osd_data(op, osd_data);

/*
* A second op in the ops array means the caller wants to
* also issue a include a 'startsync' command so that the
Expand Down

0 comments on commit fd5c1a7

Please sign in to comment.