diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2017-01-25 18:16:22 +0100 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2017-02-20 12:16:14 +0100 |
commit | 67e2b65274e3c5fc9100544c1f90adcc85dbe597 (patch) | |
tree | 97d2c9c3b9e05f6eef721da9ff8ac43fa719ee62 /drivers/block | |
parent | 7e97332ea9caad3b7c6d86bc3b982e17eda2f736 (diff) | |
download | linux-67e2b65274e3c5fc9100544c1f90adcc85dbe597.tar.bz2 |
rbd: set offset and length outside of rbd_obj_request_create()
The allocation doesn't depend on offset and length. Both offset and
length can be changed after obj_request is allocated, too.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Jason Dillaman <dillaman@redhat.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/rbd.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index ceac7877b5f4..c975d49e612c 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1631,7 +1631,9 @@ static void rbd_obj_request_submit(struct rbd_obj_request *obj_request) { struct ceph_osd_request *osd_req = obj_request->osd_req; - dout("%s %p osd_req %p\n", __func__, obj_request, osd_req); + dout("%s %p \"%s\" %llu~%llu osd_req %p\n", __func__, + obj_request, obj_request->object_name, obj_request->offset, + obj_request->length, osd_req); if (obj_request_img_data_test(obj_request)) { WARN_ON(obj_request->callback != rbd_img_obj_callback); rbd_img_request_get(obj_request->img_request); @@ -2073,7 +2075,6 @@ static void rbd_osd_req_destroy(struct ceph_osd_request *osd_req) /* object_name is assumed to be a non-null pointer and NUL-terminated */ static struct rbd_obj_request *rbd_obj_request_create(const char *object_name, - u64 offset, u64 length, enum obj_request_type type) { struct rbd_obj_request *obj_request; @@ -2094,18 +2095,13 @@ static struct rbd_obj_request *rbd_obj_request_create(const char *object_name, } obj_request->object_name = memcpy(name, object_name, size); - obj_request->offset = offset; - obj_request->length = length; - obj_request->flags = 0; obj_request->which = BAD_WHICH; obj_request->type = type; INIT_LIST_HEAD(&obj_request->links); init_completion(&obj_request->completion); kref_init(&obj_request->kref); - dout("%s: \"%s\" %llu/%llu %d -> obj %p\n", __func__, object_name, - offset, length, (int)type, obj_request); - + dout("%s %p\n", __func__, obj_request); return obj_request; } @@ -2517,21 +2513,21 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request, while (resid) { struct ceph_osd_request *osd_req; const char *object_name; - u64 offset; - u64 length; + u64 offset = rbd_segment_offset(rbd_dev, img_offset); + u64 length = rbd_segment_length(rbd_dev, img_offset, resid); object_name = rbd_segment_name(rbd_dev, img_offset); if (!object_name) goto out_unwind; - offset = rbd_segment_offset(rbd_dev, img_offset); - length = rbd_segment_length(rbd_dev, img_offset, resid); - obj_request = rbd_obj_request_create(object_name, - offset, length, type); + obj_request = rbd_obj_request_create(object_name, type); /* object request has its own copy of the object name */ rbd_segment_name_free(object_name); if (!obj_request) goto out_unwind; + obj_request->offset = offset; + obj_request->length = length; + /* * set obj_request->img_request before creating the * osd_request so that it gets the right snapc @@ -2870,7 +2866,7 @@ static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request) size_t size; int ret; - stat_request = rbd_obj_request_create(obj_request->object_name, 0, 0, + stat_request = rbd_obj_request_create(obj_request->object_name, OBJ_REQUEST_PAGES); if (!stat_request) return -ENOMEM; |