]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
librbd: fix zeroing of trailing bits on short reads that span objects
authorSage Weil <sage@newdream.net>
Thu, 19 Apr 2012 18:00:20 +0000 (11:00 -0700)
committerSage Weil <sage@newdream.net>
Fri, 20 Apr 2012 23:51:01 +0000 (16:51 -0700)
commitb94d6a6cf459478b27539eb8eccd30e19a67bbc5
treef52259d55c532f957397903975ace0ebcbfb956c
parent379c5e721e91fddbabea7e5c330bcc9c951a609e
librbd: fix zeroing of trailing bits on short reads that span objects

handle_sparse_read() was taking buf_ofs and buf_len, but buf_len was being
interpreted as the total size of the buffer, not the length of the extent
in the buffer start at buf_ofs.  Both callers pass in an extent length, so
fix the zero code to do the right thing.

Specifically, the behavior I saw was:

 - read range spanning 2 objects, trailing 20k and leading 50k
 - first object didn't exist, zeroed first 20k of buffer
 - second object didn't exist, zeroed next 30k (50k-20k) of buffer
   - the last 20k of buffer was unzeroed.

Signed-off-by: Sage Weil <sage@newdream.net>
src/librbd.cc