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 /drivers/block/rbd.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 'drivers/block/rbd.c')
-rw-r--r-- | drivers/block/rbd.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index db29783436c8..6f7a52cf75c7 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1592,7 +1592,6 @@ static int rbd_img_request_fill_bio(struct rbd_img_request *img_request, | |||
1592 | rbd_assert(resid > 0); | 1592 | rbd_assert(resid > 0); |
1593 | while (resid) { | 1593 | while (resid) { |
1594 | struct ceph_osd_request *osd_req; | 1594 | struct ceph_osd_request *osd_req; |
1595 | struct ceph_osd_data *osd_data; | ||
1596 | const char *object_name; | 1595 | const char *object_name; |
1597 | unsigned int clone_size; | 1596 | unsigned int clone_size; |
1598 | u64 offset; | 1597 | u64 offset; |
@@ -1625,13 +1624,10 @@ static int rbd_img_request_fill_bio(struct rbd_img_request *img_request, | |||
1625 | obj_request->osd_req = osd_req; | 1624 | obj_request->osd_req = osd_req; |
1626 | obj_request->callback = rbd_img_obj_callback; | 1625 | obj_request->callback = rbd_img_obj_callback; |
1627 | 1626 | ||
1628 | osd_data = write_request ? &osd_req->r_data_out | ||
1629 | : &osd_req->r_data_in; | ||
1630 | osd_req_op_extent_init(osd_req, 0, opcode, offset, length, | 1627 | osd_req_op_extent_init(osd_req, 0, opcode, offset, length, |
1631 | 0, 0); | 1628 | 0, 0); |
1632 | ceph_osd_data_bio_init(osd_data, obj_request->bio_list, | 1629 | osd_req_op_extent_osd_data_bio(osd_req, 0, write_request, |
1633 | obj_request->length); | 1630 | obj_request->bio_list, obj_request->length); |
1634 | osd_req_op_extent_osd_data(osd_req, 0, osd_data); | ||
1635 | rbd_osd_req_format(obj_request, write_request); | 1631 | rbd_osd_req_format(obj_request, write_request); |
1636 | 1632 | ||
1637 | rbd_img_obj_request_add(img_request, obj_request); | 1633 | rbd_img_obj_request_add(img_request, obj_request); |
@@ -1821,7 +1817,6 @@ static int rbd_obj_method_sync(struct rbd_device *rbd_dev, | |||
1821 | { | 1817 | { |
1822 | struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; | 1818 | struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; |
1823 | struct rbd_obj_request *obj_request; | 1819 | struct rbd_obj_request *obj_request; |
1824 | struct ceph_osd_data *osd_data; | ||
1825 | struct page **pages; | 1820 | struct page **pages; |
1826 | u32 page_count; | 1821 | u32 page_count; |
1827 | int ret; | 1822 | int ret; |
@@ -1851,13 +1846,12 @@ static int rbd_obj_method_sync(struct rbd_device *rbd_dev, | |||
1851 | if (!obj_request->osd_req) | 1846 | if (!obj_request->osd_req) |
1852 | goto out; | 1847 | goto out; |
1853 | 1848 | ||
1854 | osd_data = &obj_request->osd_req->r_data_in; | ||
1855 | osd_req_op_cls_init(obj_request->osd_req, 0, CEPH_OSD_OP_CALL, | 1849 | osd_req_op_cls_init(obj_request->osd_req, 0, CEPH_OSD_OP_CALL, |
1856 | class_name, method_name, | 1850 | class_name, method_name, |
1857 | outbound, outbound_size); | 1851 | outbound, outbound_size); |
1858 | ceph_osd_data_pages_init(osd_data, obj_request->pages, inbound_size, | 1852 | osd_req_op_cls_response_data_pages(obj_request->osd_req, 0, |
1853 | obj_request->pages, inbound_size, | ||
1859 | 0, false, false); | 1854 | 0, false, false); |
1860 | osd_req_op_cls_response_data(obj_request->osd_req, 0, osd_data); | ||
1861 | rbd_osd_req_format(obj_request, false); | 1855 | rbd_osd_req_format(obj_request, false); |
1862 | 1856 | ||
1863 | ret = rbd_obj_request_submit(osdc, obj_request); | 1857 | ret = rbd_obj_request_submit(osdc, obj_request); |
@@ -2037,7 +2031,6 @@ static int rbd_obj_read_sync(struct rbd_device *rbd_dev, | |||
2037 | { | 2031 | { |
2038 | struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; | 2032 | struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; |
2039 | struct rbd_obj_request *obj_request; | 2033 | struct rbd_obj_request *obj_request; |
2040 | struct ceph_osd_data *osd_data; | ||
2041 | struct page **pages = NULL; | 2034 | struct page **pages = NULL; |
2042 | u32 page_count; | 2035 | u32 page_count; |
2043 | size_t size; | 2036 | size_t size; |
@@ -2061,14 +2054,13 @@ static int rbd_obj_read_sync(struct rbd_device *rbd_dev, | |||
2061 | if (!obj_request->osd_req) | 2054 | if (!obj_request->osd_req) |
2062 | goto out; | 2055 | goto out; |
2063 | 2056 | ||
2064 | osd_data = &obj_request->osd_req->r_data_in; | ||
2065 | osd_req_op_extent_init(obj_request->osd_req, 0, CEPH_OSD_OP_READ, | 2057 | osd_req_op_extent_init(obj_request->osd_req, 0, CEPH_OSD_OP_READ, |
2066 | offset, length, 0, 0); | 2058 | offset, length, 0, 0); |
2067 | ceph_osd_data_pages_init(osd_data, obj_request->pages, | 2059 | osd_req_op_extent_osd_data_pages(obj_request->osd_req, 0, false, |
2060 | obj_request->pages, | ||
2068 | obj_request->length, | 2061 | obj_request->length, |
2069 | obj_request->offset & ~PAGE_MASK, | 2062 | obj_request->offset & ~PAGE_MASK, |
2070 | false, false); | 2063 | false, false); |
2071 | osd_req_op_extent_osd_data(obj_request->osd_req, 0, osd_data); | ||
2072 | rbd_osd_req_format(obj_request, false); | 2064 | rbd_osd_req_format(obj_request, false); |
2073 | 2065 | ||
2074 | ret = rbd_obj_request_submit(osdc, obj_request); | 2066 | ret = rbd_obj_request_submit(osdc, obj_request); |