aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/rbd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r--drivers/block/rbd.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 6c81a4c040b9..f556f8a8b3f9 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1264,6 +1264,32 @@ static bool obj_request_done_test(struct rbd_obj_request *obj_request)
1264 return atomic_read(&obj_request->done) != 0; 1264 return atomic_read(&obj_request->done) != 0;
1265} 1265}
1266 1266
1267static void
1268rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request)
1269{
1270 dout("%s: obj %p img %p result %d %llu/%llu\n", __func__,
1271 obj_request, obj_request->img_request, obj_request->result,
1272 obj_request->xferred, obj_request->length);
1273 /*
1274 * ENOENT means a hole in the image. We zero-fill the
1275 * entire length of the request. A short read also implies
1276 * zero-fill to the end of the request. Either way we
1277 * update the xferred count to indicate the whole request
1278 * was satisfied.
1279 */
1280 BUG_ON(obj_request->type != OBJ_REQUEST_BIO);
1281 if (obj_request->result == -ENOENT) {
1282 zero_bio_chain(obj_request->bio_list, 0);
1283 obj_request->result = 0;
1284 obj_request->xferred = obj_request->length;
1285 } else if (obj_request->xferred < obj_request->length &&
1286 !obj_request->result) {
1287 zero_bio_chain(obj_request->bio_list, obj_request->xferred);
1288 obj_request->xferred = obj_request->length;
1289 }
1290 obj_request_done_set(obj_request);
1291}
1292
1267static void rbd_obj_request_complete(struct rbd_obj_request *obj_request) 1293static void rbd_obj_request_complete(struct rbd_obj_request *obj_request)
1268{ 1294{
1269 dout("%s: obj %p cb %p\n", __func__, obj_request, 1295 dout("%s: obj %p cb %p\n", __func__, obj_request,
@@ -1284,23 +1310,10 @@ static void rbd_osd_read_callback(struct rbd_obj_request *obj_request)
1284{ 1310{
1285 dout("%s: obj %p result %d %llu/%llu\n", __func__, obj_request, 1311 dout("%s: obj %p result %d %llu/%llu\n", __func__, obj_request,
1286 obj_request->result, obj_request->xferred, obj_request->length); 1312 obj_request->result, obj_request->xferred, obj_request->length);
1287 /* 1313 if (obj_request->img_request)
1288 * ENOENT means a hole in the object. We zero-fill the 1314 rbd_img_obj_request_read_callback(obj_request);
1289 * entire length of the request. A short read also implies 1315 else
1290 * zero-fill to the end of the request. Either way we 1316 obj_request_done_set(obj_request);
1291 * update the xferred count to indicate the whole request
1292 * was satisfied.
1293 */
1294 if (obj_request->result == -ENOENT) {
1295 zero_bio_chain(obj_request->bio_list, 0);
1296 obj_request->result = 0;
1297 obj_request->xferred = obj_request->length;
1298 } else if (obj_request->xferred < obj_request->length &&
1299 !obj_request->result) {
1300 zero_bio_chain(obj_request->bio_list, obj_request->xferred);
1301 obj_request->xferred = obj_request->length;
1302 }
1303 obj_request_done_set(obj_request);
1304} 1317}
1305 1318
1306static void rbd_osd_write_callback(struct rbd_obj_request *obj_request) 1319static void rbd_osd_write_callback(struct rbd_obj_request *obj_request)