]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/ObjectCacher: handle zero bufferheads on read
authorSage Weil <sage@inktank.com>
Fri, 26 Oct 2012 18:55:34 +0000 (11:55 -0700)
committerSage Weil <sage@inktank.com>
Fri, 26 Oct 2012 18:56:05 +0000 (11:56 -0700)
Interpret a zero bufferhead as zeros in _readx().

Signed-off-by: Sage Weil <sage@inktank.com>
src/osdc/ObjectCacher.cc

index a05d75e015660a3512de7c499ed2e19ded3a7423..7597c687159cd6c1a9fdb93eac1d59456e53bb7a 100644 (file)
@@ -1015,10 +1015,16 @@ int ObjectCacher::_readx(OSDRead *rd, ObjectSet *oset, Context *onfinish,
 
        bufferlist bit;  // put substr here first, since substr_of clobbers, and
                         // we may get multiple bh's at this stripe_map position
-       bit.substr_of(bh->bl,
-                     opos - bh->start(),
-                     len);
-        stripe_map[f_it->first].claim_append(bit);
+       if (bh->is_zero()) {
+         bufferptr bp(len);
+         bp.zero();
+         stripe_map[f_it->first].push_back(bp);
+       } else {
+         bit.substr_of(bh->bl,
+                       opos - bh->start(),
+                       len);
+         stripe_map[f_it->first].claim_append(bit);
+       }
 
         opos += len;
         bhoff += len;