summaryrefslogtreecommitdiffstats
path: root/drivers/block/rbd.c
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2018-02-01 05:50:47 -0500
committerIlya Dryomov <idryomov@gmail.com>2018-04-02 04:12:42 -0400
commit0be2d60ed888a25016a05148e52feea4bf401b0e (patch)
tree2a3eaf09f4f92bd642d1106cfa9276f76f24d861 /drivers/block/rbd.c
parent15961b44947d9d53bfec0a89b5ebbcf30afeb6ac (diff)
rbd: remove obj_req->flags field
There are no standalone (!IMG_DATA) object requests anymore. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r--drivers/block/rbd.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 959aa95cd626..7ec4d143f534 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -222,10 +222,6 @@ enum obj_operation_type {
222 OBJ_OP_DISCARD, 222 OBJ_OP_DISCARD,
223}; 223};
224 224
225enum obj_req_flags {
226 OBJ_REQ_IMG_DATA, /* object usage: standalone = 0, image = 1 */
227};
228
229/* 225/*
230 * Writes go through the following state machine to deal with 226 * Writes go through the following state machine to deal with
231 * layering: 227 * layering:
@@ -252,16 +248,11 @@ struct rbd_obj_request {
252 u64 object_no; 248 u64 object_no;
253 u64 offset; /* object start byte */ 249 u64 offset; /* object start byte */
254 u64 length; /* bytes from offset */ 250 u64 length; /* bytes from offset */
255 unsigned long flags;
256 union { 251 union {
257 bool tried_parent; /* for reads */ 252 bool tried_parent; /* for reads */
258 enum rbd_obj_write_state write_state; /* for writes */ 253 enum rbd_obj_write_state write_state; /* for writes */
259 }; 254 };
260 255
261 /*
262 * An object request associated with an image will have its
263 * img_data flag set; a standalone object request will not.
264 */
265 struct rbd_img_request *img_request; 256 struct rbd_img_request *img_request;
266 u64 img_offset; 257 u64 img_offset;
267 /* links for img_request->obj_requests list */ 258 /* links for img_request->obj_requests list */
@@ -1291,28 +1282,6 @@ static void rbd_obj_zero_range(struct rbd_obj_request *obj_req, u32 off,
1291 } 1282 }
1292} 1283}
1293 1284
1294/*
1295 * The default/initial value for all object request flags is 0. For
1296 * each flag, once its value is set to 1 it is never reset to 0
1297 * again.
1298 */
1299static void obj_request_img_data_set(struct rbd_obj_request *obj_request)
1300{
1301 if (test_and_set_bit(OBJ_REQ_IMG_DATA, &obj_request->flags)) {
1302 struct rbd_device *rbd_dev;
1303
1304 rbd_dev = obj_request->img_request->rbd_dev;
1305 rbd_warn(rbd_dev, "obj_request %p already marked img_data",
1306 obj_request);
1307 }
1308}
1309
1310static bool obj_request_img_data_test(struct rbd_obj_request *obj_request)
1311{
1312 smp_mb();
1313 return test_bit(OBJ_REQ_IMG_DATA, &obj_request->flags) != 0;
1314}
1315
1316static bool obj_request_overlaps_parent(struct rbd_obj_request *obj_request) 1285static bool obj_request_overlaps_parent(struct rbd_obj_request *obj_request)
1317{ 1286{
1318 struct rbd_device *rbd_dev = obj_request->img_request->rbd_dev; 1287 struct rbd_device *rbd_dev = obj_request->img_request->rbd_dev;
@@ -1365,8 +1334,6 @@ static inline void rbd_img_obj_request_add(struct rbd_img_request *img_request,
1365 1334
1366 /* Image request now owns object's original reference */ 1335 /* Image request now owns object's original reference */
1367 obj_request->img_request = img_request; 1336 obj_request->img_request = img_request;
1368 rbd_assert(!obj_request_img_data_test(obj_request));
1369 obj_request_img_data_set(obj_request);
1370 img_request->obj_request_count++; 1337 img_request->obj_request_count++;
1371 img_request->pending_count++; 1338 img_request->pending_count++;
1372 list_add_tail(&obj_request->links, &img_request->obj_requests); 1339 list_add_tail(&obj_request->links, &img_request->obj_requests);
@@ -1380,7 +1347,6 @@ static inline void rbd_img_obj_request_del(struct rbd_img_request *img_request,
1380 list_del(&obj_request->links); 1347 list_del(&obj_request->links);
1381 rbd_assert(img_request->obj_request_count > 0); 1348 rbd_assert(img_request->obj_request_count > 0);
1382 img_request->obj_request_count--; 1349 img_request->obj_request_count--;
1383 rbd_assert(obj_request_img_data_test(obj_request));
1384 rbd_assert(obj_request->img_request == img_request); 1350 rbd_assert(obj_request->img_request == img_request);
1385 obj_request->img_request = NULL; 1351 obj_request->img_request = NULL;
1386 rbd_obj_request_put(obj_request); 1352 rbd_obj_request_put(obj_request);
@@ -1506,7 +1472,6 @@ static void rbd_osd_req_format_read(struct rbd_obj_request *obj_request)
1506{ 1472{
1507 struct ceph_osd_request *osd_req = obj_request->osd_req; 1473 struct ceph_osd_request *osd_req = obj_request->osd_req;
1508 1474
1509 rbd_assert(obj_request_img_data_test(obj_request));
1510 osd_req->r_flags = CEPH_OSD_FLAG_READ; 1475 osd_req->r_flags = CEPH_OSD_FLAG_READ;
1511 osd_req->r_snapid = obj_request->img_request->snap_id; 1476 osd_req->r_snapid = obj_request->img_request->snap_id;
1512} 1477}