libceph: separate read and write data
An osd request defines information about where data to be read
should be placed as well as where data to write comes from.
Currently these are represented by common fields.
Keep information about data for writing separate from data to be
read by splitting these into data_in and data_out fields.
This is the key patch in this whole series, in that it actually
identifies which osd requests generate outgoing data and which
generate incoming data. It's less obvious (currently) that an osd
CALL op generates both outgoing and incoming data; that's the focus
of some upcoming work.
This resolves:
http://tracker.ceph.com/issues/4127
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index f189bc2..3f69eb1 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1398,6 +1398,7 @@
struct ceph_snap_context *snapc = NULL;
struct ceph_osd_client *osdc;
struct ceph_osd_request *osd_req;
+ struct ceph_osd_data *osd_data;
struct timespec now;
struct timespec *mtime;
u64 snap_id = CEPH_NOSNAP;
@@ -1418,6 +1419,7 @@
osd_req = ceph_osdc_alloc_request(osdc, snapc, 1, false, GFP_ATOMIC);
if (!osd_req)
return NULL; /* ENOMEM */
+ osd_data = write_request ? &osd_req->r_data_out : &osd_req->r_data_in;
rbd_assert(obj_request_type_valid(obj_request->type));
switch (obj_request->type) {
@@ -1425,16 +1427,16 @@
break; /* Nothing to do */
case OBJ_REQUEST_BIO:
rbd_assert(obj_request->bio_list != NULL);
- osd_req->r_data.type = CEPH_OSD_DATA_TYPE_BIO;
- osd_req->r_data.bio = obj_request->bio_list;
+ osd_data->type = CEPH_OSD_DATA_TYPE_BIO;
+ osd_data->bio = obj_request->bio_list;
break;
case OBJ_REQUEST_PAGES:
- osd_req->r_data.type = CEPH_OSD_DATA_TYPE_PAGES;
- osd_req->r_data.pages = obj_request->pages;
- osd_req->r_data.num_pages = obj_request->page_count;
- osd_req->r_data.alignment = offset & ~PAGE_MASK;
- osd_req->r_data.pages_from_pool = false;
- osd_req->r_data.own_pages = false;
+ osd_data->type = CEPH_OSD_DATA_TYPE_PAGES;
+ osd_data->pages = obj_request->pages;
+ osd_data->num_pages = obj_request->page_count;
+ osd_data->alignment = offset & ~PAGE_MASK;
+ osd_data->pages_from_pool = false;
+ osd_data->own_pages = false;
break;
}