diff options
author | Ilya Dryomov <ilya.dryomov@inktank.com> | 2014-02-25 09:22:27 -0500 |
---|---|---|
committer | Yan, Zheng <zheng.z.yan@intel.com> | 2014-04-02 22:33:52 -0400 |
commit | deb236b300cea3e7a114115571194b9872dbdfd1 (patch) | |
tree | 8dddef5c49b6af5bacfc42959549b7181679b5db | |
parent | 7cc69d42e6950404587bef9489a5ed6f9f6bab4e (diff) |
rbd: num_ops parameter for rbd_osd_req_create()
In preparation for prefixing rbd writes with an allocation hint
introduce a num_ops parameter for rbd_osd_req_create(). The rationale
is that not every write request is a write op that needs to be prefixed
(e.g. watch op), so the num_ops logic needs to be in the callers.
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Reviewed-by: Alex Elder <elder@linaro.org>
-rw-r--r-- | drivers/block/rbd.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 4c612c4041b6..42ecae1436cc 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1718,6 +1718,7 @@ static void rbd_osd_req_format_write(struct rbd_obj_request *obj_request) | |||
1718 | static struct ceph_osd_request *rbd_osd_req_create( | 1718 | static struct ceph_osd_request *rbd_osd_req_create( |
1719 | struct rbd_device *rbd_dev, | 1719 | struct rbd_device *rbd_dev, |
1720 | bool write_request, | 1720 | bool write_request, |
1721 | unsigned int num_ops, | ||
1721 | struct rbd_obj_request *obj_request) | 1722 | struct rbd_obj_request *obj_request) |
1722 | { | 1723 | { |
1723 | struct ceph_snap_context *snapc = NULL; | 1724 | struct ceph_snap_context *snapc = NULL; |
@@ -1733,10 +1734,13 @@ static struct ceph_osd_request *rbd_osd_req_create( | |||
1733 | snapc = img_request->snapc; | 1734 | snapc = img_request->snapc; |
1734 | } | 1735 | } |
1735 | 1736 | ||
1736 | /* Allocate and initialize the request, for the single op */ | 1737 | rbd_assert(num_ops == 1); |
1738 | |||
1739 | /* Allocate and initialize the request, for the num_ops ops */ | ||
1737 | 1740 | ||
1738 | osdc = &rbd_dev->rbd_client->client->osdc; | 1741 | osdc = &rbd_dev->rbd_client->client->osdc; |
1739 | osd_req = ceph_osdc_alloc_request(osdc, snapc, 1, false, GFP_ATOMIC); | 1742 | osd_req = ceph_osdc_alloc_request(osdc, snapc, num_ops, false, |
1743 | GFP_ATOMIC); | ||
1740 | if (!osd_req) | 1744 | if (!osd_req) |
1741 | return NULL; /* ENOMEM */ | 1745 | return NULL; /* ENOMEM */ |
1742 | 1746 | ||
@@ -2220,8 +2224,8 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request, | |||
2220 | pages += page_count; | 2224 | pages += page_count; |
2221 | } | 2225 | } |
2222 | 2226 | ||
2223 | osd_req = rbd_osd_req_create(rbd_dev, write_request, | 2227 | osd_req = rbd_osd_req_create(rbd_dev, write_request, 1, |
2224 | obj_request); | 2228 | obj_request); |
2225 | if (!osd_req) | 2229 | if (!osd_req) |
2226 | goto out_unwind; | 2230 | goto out_unwind; |
2227 | obj_request->osd_req = osd_req; | 2231 | obj_request->osd_req = osd_req; |
@@ -2602,8 +2606,8 @@ static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request) | |||
2602 | 2606 | ||
2603 | rbd_assert(obj_request->img_request); | 2607 | rbd_assert(obj_request->img_request); |
2604 | rbd_dev = obj_request->img_request->rbd_dev; | 2608 | rbd_dev = obj_request->img_request->rbd_dev; |
2605 | stat_request->osd_req = rbd_osd_req_create(rbd_dev, false, | 2609 | stat_request->osd_req = rbd_osd_req_create(rbd_dev, false, 1, |
2606 | stat_request); | 2610 | stat_request); |
2607 | if (!stat_request->osd_req) | 2611 | if (!stat_request->osd_req) |
2608 | goto out; | 2612 | goto out; |
2609 | stat_request->callback = rbd_img_obj_exists_callback; | 2613 | stat_request->callback = rbd_img_obj_exists_callback; |
@@ -2806,7 +2810,8 @@ static int rbd_obj_notify_ack_sync(struct rbd_device *rbd_dev, u64 notify_id) | |||
2806 | return -ENOMEM; | 2810 | return -ENOMEM; |
2807 | 2811 | ||
2808 | ret = -ENOMEM; | 2812 | ret = -ENOMEM; |
2809 | obj_request->osd_req = rbd_osd_req_create(rbd_dev, false, obj_request); | 2813 | obj_request->osd_req = rbd_osd_req_create(rbd_dev, false, 1, |
2814 | obj_request); | ||
2810 | if (!obj_request->osd_req) | 2815 | if (!obj_request->osd_req) |
2811 | goto out; | 2816 | goto out; |
2812 | 2817 | ||
@@ -2869,7 +2874,8 @@ static int __rbd_dev_header_watch_sync(struct rbd_device *rbd_dev, bool start) | |||
2869 | if (!obj_request) | 2874 | if (!obj_request) |
2870 | goto out_cancel; | 2875 | goto out_cancel; |
2871 | 2876 | ||
2872 | obj_request->osd_req = rbd_osd_req_create(rbd_dev, true, obj_request); | 2877 | obj_request->osd_req = rbd_osd_req_create(rbd_dev, true, 1, |
2878 | obj_request); | ||
2873 | if (!obj_request->osd_req) | 2879 | if (!obj_request->osd_req) |
2874 | goto out_cancel; | 2880 | goto out_cancel; |
2875 | 2881 | ||
@@ -2977,7 +2983,8 @@ static int rbd_obj_method_sync(struct rbd_device *rbd_dev, | |||
2977 | obj_request->pages = pages; | 2983 | obj_request->pages = pages; |
2978 | obj_request->page_count = page_count; | 2984 | obj_request->page_count = page_count; |
2979 | 2985 | ||
2980 | obj_request->osd_req = rbd_osd_req_create(rbd_dev, false, obj_request); | 2986 | obj_request->osd_req = rbd_osd_req_create(rbd_dev, false, 1, |
2987 | obj_request); | ||
2981 | if (!obj_request->osd_req) | 2988 | if (!obj_request->osd_req) |
2982 | goto out; | 2989 | goto out; |
2983 | 2990 | ||
@@ -3210,7 +3217,8 @@ static int rbd_obj_read_sync(struct rbd_device *rbd_dev, | |||
3210 | obj_request->pages = pages; | 3217 | obj_request->pages = pages; |
3211 | obj_request->page_count = page_count; | 3218 | obj_request->page_count = page_count; |
3212 | 3219 | ||
3213 | obj_request->osd_req = rbd_osd_req_create(rbd_dev, false, obj_request); | 3220 | obj_request->osd_req = rbd_osd_req_create(rbd_dev, false, 1, |
3221 | obj_request); | ||
3214 | if (!obj_request->osd_req) | 3222 | if (!obj_request->osd_req) |
3215 | goto out; | 3223 | goto out; |
3216 | 3224 | ||