aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-11-30 18:53:04 -0500
committerSage Weil <sage@inktank.com>2013-02-13 21:29:07 -0500
commit7d250b949a33c8a658a2ad4ab390d8394b842224 (patch)
treed5517f5531aafeb07b607816fe50e0daa1f0ad49 /drivers/block
parent2250a71b591728092db9adcc51629401deb2f9f8 (diff)
rbd: kill rbd_req_coll and rbd_request
The two remaining callers of rbd_do_request() always pass a null collection pointer, so the "coll" and "coll_index" parameters are not needed. There is no other use of that data structure, so it can be eliminated. Deleting them means there is no need to allocate a rbd_request structure for the callback function. And since that's the only use of *that* structure, it too can be eliminated. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c58
1 files changed, 3 insertions, 55 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 4c175a7d3f7e..c1bb649b4ad1 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -162,25 +162,6 @@ struct rbd_client {
162 struct list_head node; 162 struct list_head node;
163}; 163};
164 164
165/*
166 * a request completion status
167 */
168struct rbd_req_status {
169 int done;
170 s32 rc;
171 u64 bytes;
172};
173
174/*
175 * a collection of requests
176 */
177struct rbd_req_coll {
178 int total;
179 int num_done;
180 struct kref kref;
181 struct rbd_req_status status[0];
182};
183
184struct rbd_img_request; 165struct rbd_img_request;
185typedef void (*rbd_img_callback_t)(struct rbd_img_request *); 166typedef void (*rbd_img_callback_t)(struct rbd_img_request *);
186 167
@@ -242,18 +223,6 @@ struct rbd_img_request {
242#define for_each_obj_request_safe(ireq, oreq, n) \ 223#define for_each_obj_request_safe(ireq, oreq, n) \
243 list_for_each_entry_safe_reverse(oreq, n, &ireq->obj_requests, links) 224 list_for_each_entry_safe_reverse(oreq, n, &ireq->obj_requests, links)
244 225
245/*
246 * a single io request
247 */
248struct rbd_request {
249 struct request *rq; /* blk layer request */
250 struct bio *bio; /* cloned bio */
251 struct page **pages; /* list of used pages */
252 u64 len;
253 int coll_index;
254 struct rbd_req_coll *coll;
255};
256
257struct rbd_snap { 226struct rbd_snap {
258 struct device dev; 227 struct device dev;
259 const char *name; 228 const char *name;
@@ -1195,21 +1164,18 @@ static int rbd_do_request(struct request *rq,
1195 int num_pages, 1164 int num_pages,
1196 int flags, 1165 int flags,
1197 struct ceph_osd_req_op *op, 1166 struct ceph_osd_req_op *op,
1198 struct rbd_req_coll *coll,
1199 int coll_index,
1200 void (*rbd_cb)(struct ceph_osd_request *, 1167 void (*rbd_cb)(struct ceph_osd_request *,
1201 struct ceph_msg *), 1168 struct ceph_msg *),
1202 u64 *ver) 1169 u64 *ver)
1203{ 1170{
1204 struct ceph_osd_client *osdc; 1171 struct ceph_osd_client *osdc;
1205 struct ceph_osd_request *osd_req; 1172 struct ceph_osd_request *osd_req;
1206 struct rbd_request *rbd_req = NULL;
1207 struct timespec mtime = CURRENT_TIME; 1173 struct timespec mtime = CURRENT_TIME;
1208 int ret; 1174 int ret;
1209 1175
1210 dout("rbd_do_request object_name=%s ofs=%llu len=%llu coll=%p[%d]\n", 1176 dout("rbd_do_request object_name=%s ofs=%llu len=%llu\n",
1211 object_name, (unsigned long long) ofs, 1177 object_name, (unsigned long long) ofs,
1212 (unsigned long long) len, coll, coll_index); 1178 (unsigned long long) len);
1213 1179
1214 osdc = &rbd_dev->rbd_client->client->osdc; 1180 osdc = &rbd_dev->rbd_client->client->osdc;
1215 osd_req = ceph_osdc_alloc_request(osdc, snapc, 1, false, GFP_NOIO); 1181 osd_req = ceph_osdc_alloc_request(osdc, snapc, 1, false, GFP_NOIO);
@@ -1223,22 +1189,8 @@ static int rbd_do_request(struct request *rq,
1223 bio_get(osd_req->r_bio); 1189 bio_get(osd_req->r_bio);
1224 } 1190 }
1225 1191
1226 if (coll) {
1227 ret = -ENOMEM;
1228 rbd_req = kmalloc(sizeof(*rbd_req), GFP_NOIO);
1229 if (!rbd_req)
1230 goto done_osd_req;
1231
1232 rbd_req->rq = rq;
1233 rbd_req->bio = bio;
1234 rbd_req->pages = pages;
1235 rbd_req->len = len;
1236 rbd_req->coll = coll;
1237 rbd_req->coll_index = coll_index;
1238 }
1239
1240 osd_req->r_callback = rbd_cb; 1192 osd_req->r_callback = rbd_cb;
1241 osd_req->r_priv = rbd_req; 1193 osd_req->r_priv = NULL;
1242 1194
1243 strncpy(osd_req->r_oid, object_name, sizeof(osd_req->r_oid)); 1195 strncpy(osd_req->r_oid, object_name, sizeof(osd_req->r_oid));
1244 osd_req->r_oid_len = strlen(osd_req->r_oid); 1196 osd_req->r_oid_len = strlen(osd_req->r_oid);
@@ -1274,8 +1226,6 @@ static int rbd_do_request(struct request *rq,
1274done_err: 1226done_err:
1275 if (bio) 1227 if (bio)
1276 bio_chain_put(osd_req->r_bio); 1228 bio_chain_put(osd_req->r_bio);
1277 kfree(rbd_req);
1278done_osd_req:
1279 ceph_osdc_put_request(osd_req); 1229 ceph_osdc_put_request(osd_req);
1280 1230
1281 return ret; 1231 return ret;
@@ -1314,7 +1264,6 @@ static int rbd_req_sync_op(struct rbd_device *rbd_dev,
1314 pages, num_pages, 1264 pages, num_pages,
1315 flags, 1265 flags,
1316 op, 1266 op,
1317 NULL, 0,
1318 NULL, 1267 NULL,
1319 ver); 1268 ver);
1320 if (ret < 0) 1269 if (ret < 0)
@@ -1390,7 +1339,6 @@ static int rbd_req_sync_notify_ack(struct rbd_device *rbd_dev,
1390 NULL, 0, 1339 NULL, 0,
1391 CEPH_OSD_FLAG_READ, 1340 CEPH_OSD_FLAG_READ,
1392 op, 1341 op,
1393 NULL, 0,
1394 rbd_simple_req_cb, NULL); 1342 rbd_simple_req_cb, NULL);
1395 1343
1396 rbd_osd_req_op_destroy(op); 1344 rbd_osd_req_op_destroy(op);