diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-03-29 14:47:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-03-29 14:47:43 -0400 |
commit | b92eded4b7e6facc4e4ba07de89a3fc24de99552 (patch) | |
tree | 5efe4d2959768a27eb5cd42573b8390cd6a1fb44 /drivers/block | |
parent | 3615db41c4b82896de450b6b4e3dab2420dcae51 (diff) | |
parent | 6e2a4505dba0cae8faa701426185dfb7b49f537c (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client
Pull ceph fix from Sage Weil:
"This fixes a regression introduced during the last merge window when
mapping non-existent images."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
rbd: don't zero-fill non-image object requests
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/rbd.c | 47 |
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 | ||
1267 | static void | ||
1268 | rbd_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 | |||
1267 | static void rbd_obj_request_complete(struct rbd_obj_request *obj_request) | 1293 | static 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 | ||
1306 | static void rbd_osd_write_callback(struct rbd_obj_request *obj_request) | 1319 | static void rbd_osd_write_callback(struct rbd_obj_request *obj_request) |