Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 373430
b: refs/heads/master
c: a4ce40a
h: refs/heads/master
v: v3
  • Loading branch information
Alex Elder authored and Sage Weil committed May 2, 2013
1 parent e1396dc commit a0d46d4
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 73 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: 39b44cbe86db42e70693787b2ede81c309925d0b
refs/heads/master: a4ce40a9a7c1053ac2a41cf64255e44e356e5522
20 changes: 6 additions & 14 deletions trunk/drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,6 @@ static int rbd_img_request_fill_bio(struct rbd_img_request *img_request,
rbd_assert(resid > 0);
while (resid) {
struct ceph_osd_request *osd_req;
struct ceph_osd_data *osd_data;
const char *object_name;
unsigned int clone_size;
u64 offset;
Expand Down Expand Up @@ -1625,13 +1624,10 @@ static int rbd_img_request_fill_bio(struct rbd_img_request *img_request,
obj_request->osd_req = osd_req;
obj_request->callback = rbd_img_obj_callback;

osd_data = write_request ? &osd_req->r_data_out
: &osd_req->r_data_in;
osd_req_op_extent_init(osd_req, 0, opcode, offset, length,
0, 0);
ceph_osd_data_bio_init(osd_data, obj_request->bio_list,
obj_request->length);
osd_req_op_extent_osd_data(osd_req, 0, osd_data);
osd_req_op_extent_osd_data_bio(osd_req, 0, write_request,
obj_request->bio_list, obj_request->length);
rbd_osd_req_format(obj_request, write_request);

rbd_img_obj_request_add(img_request, obj_request);
Expand Down Expand Up @@ -1821,7 +1817,6 @@ static int rbd_obj_method_sync(struct rbd_device *rbd_dev,
{
struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc;
struct rbd_obj_request *obj_request;
struct ceph_osd_data *osd_data;
struct page **pages;
u32 page_count;
int ret;
Expand Down Expand Up @@ -1851,13 +1846,12 @@ static int rbd_obj_method_sync(struct rbd_device *rbd_dev,
if (!obj_request->osd_req)
goto out;

osd_data = &obj_request->osd_req->r_data_in;
osd_req_op_cls_init(obj_request->osd_req, 0, CEPH_OSD_OP_CALL,
class_name, method_name,
outbound, outbound_size);
ceph_osd_data_pages_init(osd_data, obj_request->pages, inbound_size,
osd_req_op_cls_response_data_pages(obj_request->osd_req, 0,
obj_request->pages, inbound_size,
0, false, false);
osd_req_op_cls_response_data(obj_request->osd_req, 0, osd_data);
rbd_osd_req_format(obj_request, false);

ret = rbd_obj_request_submit(osdc, obj_request);
Expand Down Expand Up @@ -2037,7 +2031,6 @@ static int rbd_obj_read_sync(struct rbd_device *rbd_dev,
{
struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc;
struct rbd_obj_request *obj_request;
struct ceph_osd_data *osd_data;
struct page **pages = NULL;
u32 page_count;
size_t size;
Expand All @@ -2061,14 +2054,13 @@ static int rbd_obj_read_sync(struct rbd_device *rbd_dev,
if (!obj_request->osd_req)
goto out;

osd_data = &obj_request->osd_req->r_data_in;
osd_req_op_extent_init(obj_request->osd_req, 0, CEPH_OSD_OP_READ,
offset, length, 0, 0);
ceph_osd_data_pages_init(osd_data, obj_request->pages,
osd_req_op_extent_osd_data_pages(obj_request->osd_req, 0, false,
obj_request->pages,
obj_request->length,
obj_request->offset & ~PAGE_MASK,
false, false);
osd_req_op_extent_osd_data(obj_request->osd_req, 0, osd_data);
rbd_osd_req_format(obj_request, false);

ret = rbd_obj_request_submit(osdc, obj_request);
Expand Down
12 changes: 5 additions & 7 deletions trunk/fs/ceph/addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)
dout("finish_read %p req %p rc %d bytes %d\n", inode, req, rc, bytes);

/* unlock all pages, zeroing any data we didn't read */
osd_data = &req->r_data_in;
osd_data = osd_req_op_extent_osd_data(req, 0, false);
BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES);
num_pages = calc_pages_for((u64)osd_data->alignment,
(u64)osd_data->length);
Expand Down Expand Up @@ -343,8 +343,7 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max)
}
pages[i] = page;
}
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,
osd_req_op_extent_osd_data_pages(req, 0, false, pages, len, 0,
false, false);
req->r_callback = finish_read;
req->r_inode = inode;
Expand Down Expand Up @@ -572,7 +571,7 @@ static void writepages_finish(struct ceph_osd_request *req,
long writeback_stat;
unsigned issued = ceph_caps_issued(ci);

osd_data = &req->r_data_out;
osd_data = osd_req_op_extent_osd_data(req, 0, true);
BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES);
num_pages = calc_pages_for((u64)osd_data->alignment,
(u64)osd_data->length);
Expand Down Expand Up @@ -917,9 +916,8 @@ static int ceph_writepages_start(struct address_space *mapping,
dout("writepages got %d pages at %llu~%llu\n",
locked_pages, offset, len);

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);
osd_req_op_extent_osd_data_pages(req, 0, true, pages, len, 0,
!!pool, false);

pages = NULL; /* request message now owns the pages array */
pool = NULL;
Expand Down
3 changes: 1 addition & 2 deletions trunk/fs/ceph/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,7 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data,
own_pages = true;
}
}
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,
osd_req_op_extent_osd_data_pages(req, 0, true, pages, len,
page_align, false, own_pages);

/* BUG_ON(vino.snap != CEPH_NOSNAP); */
Expand Down
43 changes: 27 additions & 16 deletions trunk/include/linux/ceph/osd_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,39 @@ extern void osd_req_op_extent_init(struct ceph_osd_request *osd_req,
u64 truncate_size, u32 truncate_seq);
extern void osd_req_op_extent_update(struct ceph_osd_request *osd_req,
unsigned int which, u64 length);
extern void osd_req_op_extent_osd_data(struct ceph_osd_request *osd_req,

extern struct ceph_osd_data *osd_req_op_extent_osd_data(
struct ceph_osd_request *osd_req,
unsigned int which, bool write_request);
extern struct ceph_osd_data *osd_req_op_cls_response_data(
struct ceph_osd_request *osd_req,
unsigned int which);

extern void osd_req_op_extent_osd_data_pages(struct ceph_osd_request *,
unsigned int which, bool write_request,
struct page **pages, u64 length,
u32 alignment, bool pages_from_pool,
bool own_pages);
extern void osd_req_op_extent_osd_data_pagelist(struct ceph_osd_request *,
unsigned int which, bool write_request,
struct ceph_pagelist *pagelist);
#ifdef CONFIG_BLOCK
extern void osd_req_op_extent_osd_data_bio(struct ceph_osd_request *,
unsigned int which, bool write_request,
struct bio *bio, size_t bio_length);
#endif /* CONFIG_BLOCK */

extern void osd_req_op_cls_response_data_pages(struct ceph_osd_request *,
unsigned int which,
struct ceph_osd_data *osd_data);
struct page **pages, u64 length,
u32 alignment, bool pages_from_pool,
bool own_pages);

extern void osd_req_op_cls_init(struct ceph_osd_request *osd_req,
unsigned int which, 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_request *osd_req,
unsigned int which,
struct ceph_osd_data *response_data);
extern void osd_req_op_watch_init(struct ceph_osd_request *osd_req,
unsigned int which, u16 opcode,
u64 cookie, u64 version, int flag);
Expand Down Expand Up @@ -290,17 +312,6 @@ static inline void ceph_osdc_put_request(struct ceph_osd_request *req)
kref_put(&req->r_kref, ceph_osdc_release_request);
}

extern void ceph_osd_data_pages_init(struct ceph_osd_data *osd_data,
struct page **pages, u64 length,
u32 alignment, bool pages_from_pool,
bool own_pages);
extern void ceph_osd_data_pagelist_init(struct ceph_osd_data *osd_data,
struct ceph_pagelist *pagelist);
#ifdef CONFIG_BLOCK
extern void ceph_osd_data_bio_init(struct ceph_osd_data *osd_data,
struct bio *bio, size_t bio_length);
#endif /* CONFIG_BLOCK */

extern int ceph_osdc_start_request(struct ceph_osd_client *osdc,
struct ceph_osd_request *req,
bool nofail);
Expand Down
Loading

0 comments on commit a0d46d4

Please sign in to comment.