summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2011-06-23 02:13:22 +0200
committerYehuda Sadeh <yehuda@hq.newdream.net>2011-06-23 02:13:22 +0200
commit5da066286c81fbb7ed1c63281252368b039c07bb (patch)
tree50bdcf60f077830782bc30029dd3dc916470fe4b
parentlibrbd: track block_ofs instead of ofs in aio_sparse_read callback (diff)
downloadceph-5da066286c81fbb7ed1c63281252368b039c07bb.tar.xz
ceph-5da066286c81fbb7ed1c63281252368b039c07bb.zip
librados: fix end_block calculation for aio_read
-rw-r--r--src/librbd.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librbd.cc b/src/librbd.cc
index 73dba632c94..095790a2a2a 100644
--- a/src/librbd.cc
+++ b/src/librbd.cc
@@ -1251,7 +1251,7 @@ void AioBlockCompletion::complete(ssize_t r)
dout(10) << "block_ofs=" << block_ofs << dendl;
/* a hole? */
- if (extent_ofs - block_ofs) {
+ if (extent_ofs - block_ofs > 0) {
dout(10) << "<1>zeroing " << buf_bl_pos << "~" << extent_ofs << dendl;
dout(10) << "buf=" << (void *)(buf + buf_bl_pos) << "~" << (void *)(buf + extent_ofs - ofs - 1) << dendl;
memset(buf + buf_bl_pos, 0, extent_ofs - block_ofs);
@@ -1391,7 +1391,7 @@ int aio_read(ImageCtx *ictx, uint64_t off, size_t len,
int64_t ret;
int total_read = 0;
uint64_t start_block = get_block_num(&ictx->header, off);
- uint64_t end_block = get_block_num(&ictx->header, off + len);
+ uint64_t end_block = get_block_num(&ictx->header, off + len - 1);
uint64_t block_size = get_block_size(&ictx->header);
uint64_t left = len;