]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: make read_iterate mirror AioCompletion::complete
authorJosh Durgin <josh.durgin@dreamhost.com>
Tue, 9 Aug 2011 19:29:15 +0000 (12:29 -0700)
committerSage Weil <sage@newdream.net>
Thu, 11 Aug 2011 17:06:10 +0000 (10:06 -0700)
This makes testlibrbd and testlibrbdpp pass again, and
now both I/O paths have the same logic.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
src/librbd.cc

index a60920a5e67f62ba13f6c3f223afd1782ffb0485..451952a711413d7258b0251631c957026badc0aa 100644 (file)
@@ -1167,9 +1167,10 @@ int64_t read_iterate(ImageCtx *ictx, uint64_t off, size_t len,
         block_read += extent_ofs - block_ofs;
       }
 
-      if (bl_ofs + extent_len > bl.length())
+      if (bl_ofs + extent_len > bl.length()) {
         return -EIO;
-
+      }
+      block_read += extent_ofs - block_ofs;
       block_ofs = extent_ofs;
 
       /* data */
@@ -1182,8 +1183,13 @@ int64_t read_iterate(ImageCtx *ictx, uint64_t off, size_t len,
     }
 
     /* last hole */
-    if (read_len - block_ofs) {
-      r = cb(total_read + block_read, read_len - block_ofs, NULL, arg);
+    if (read_len - block_read) {
+      ldout(ictx->cct, 20) << "last hole read_len=" << read_len
+                          << " block_ofs=" << block_ofs
+                          << " block_read=" << block_read
+                          << " total_read=" << total_read
+                          << dendl;
+      r = cb(total_read + block_read, read_len - block_read, NULL, arg);
       if (r < 0)
         return r;
     }