diff options
author | Alex Elder <elder@inktank.com> | 2013-04-05 02:27:12 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-02 00:18:23 -0400 |
commit | a4ce40a9a7c1053ac2a41cf64255e44e356e5522 (patch) | |
tree | de1aeb42625f19f6cfe8806db333ec853de0f5b7 /fs/ceph/addr.c | |
parent | 39b44cbe86db42e70693787b2ede81c309925d0b (diff) |
libceph: combine initializing and setting osd data
This ends up being a rather large patch but what it's doing is
somewhat straightforward.
Basically, this is replacing two calls with one. The first of the
two calls is initializing a struct ceph_osd_data with data (either a
page array, a page list, or a bio list); the second is setting an
osd request op so it associates that data with one of the op's
parameters. In place of those two will be a single function that
initializes the op directly.
That means we sort of fan out a set of the needed functions:
- extent ops with pages data
- extent ops with pagelist data
- extent ops with bio list data
and
- class ops with page data for receiving a response
We also have define another one, but it's only used internally:
- class ops with pagelist data for request parameters
Note that we *still* haven't gotten rid of the osd request's
r_data_in and r_data_out fields. All the osd ops refer to them for
their data. For now, these data fields are pointers assigned to the
appropriate r_data_* field when these new functions are called.
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'fs/ceph/addr.c')
-rw-r--r-- | fs/ceph/addr.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index cc57104a7266..27d62070a8e9 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
@@ -245,7 +245,7 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg) | |||
245 | dout("finish_read %p req %p rc %d bytes %d\n", inode, req, rc, bytes); | 245 | dout("finish_read %p req %p rc %d bytes %d\n", inode, req, rc, bytes); |
246 | 246 | ||
247 | /* unlock all pages, zeroing any data we didn't read */ | 247 | /* unlock all pages, zeroing any data we didn't read */ |
248 | osd_data = &req->r_data_in; | 248 | osd_data = osd_req_op_extent_osd_data(req, 0, false); |
249 | BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES); | 249 | BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES); |
250 | num_pages = calc_pages_for((u64)osd_data->alignment, | 250 | num_pages = calc_pages_for((u64)osd_data->alignment, |
251 | (u64)osd_data->length); | 251 | (u64)osd_data->length); |
@@ -343,8 +343,7 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max) | |||
343 | } | 343 | } |
344 | pages[i] = page; | 344 | pages[i] = page; |
345 | } | 345 | } |
346 | BUG_ON(req->r_ops[0].extent.osd_data != &req->r_data_in); | 346 | osd_req_op_extent_osd_data_pages(req, 0, false, pages, len, 0, |
347 | ceph_osd_data_pages_init(req->r_ops[0].extent.osd_data, pages, len, 0, | ||
348 | false, false); | 347 | false, false); |
349 | req->r_callback = finish_read; | 348 | req->r_callback = finish_read; |
350 | req->r_inode = inode; | 349 | req->r_inode = inode; |
@@ -572,7 +571,7 @@ static void writepages_finish(struct ceph_osd_request *req, | |||
572 | long writeback_stat; | 571 | long writeback_stat; |
573 | unsigned issued = ceph_caps_issued(ci); | 572 | unsigned issued = ceph_caps_issued(ci); |
574 | 573 | ||
575 | osd_data = &req->r_data_out; | 574 | osd_data = osd_req_op_extent_osd_data(req, 0, true); |
576 | BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES); | 575 | BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES); |
577 | num_pages = calc_pages_for((u64)osd_data->alignment, | 576 | num_pages = calc_pages_for((u64)osd_data->alignment, |
578 | (u64)osd_data->length); | 577 | (u64)osd_data->length); |
@@ -917,9 +916,8 @@ get_more_pages: | |||
917 | dout("writepages got %d pages at %llu~%llu\n", | 916 | dout("writepages got %d pages at %llu~%llu\n", |
918 | locked_pages, offset, len); | 917 | locked_pages, offset, len); |
919 | 918 | ||
920 | BUG_ON(req->r_ops[0].extent.osd_data != &req->r_data_out); | 919 | osd_req_op_extent_osd_data_pages(req, 0, true, pages, len, 0, |
921 | ceph_osd_data_pages_init(req->r_ops[0].extent.osd_data, pages, | 920 | !!pool, false); |
922 | len, 0, !!pool, false); | ||
923 | 921 | ||
924 | pages = NULL; /* request message now owns the pages array */ | 922 | pages = NULL; /* request message now owns the pages array */ |
925 | pool = NULL; | 923 | pool = NULL; |