]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: mark used range on partial blob writes
authorSage Weil <sage@redhat.com>
Thu, 19 May 2016 12:45:00 +0000 (08:45 -0400)
committerSage Weil <sage@redhat.com>
Wed, 1 Jun 2016 15:38:51 +0000 (11:38 -0400)
- writing into unreferenced blob space
- wal blob writes

both need to update the blob used map.  The full blob writes generates
blobs that are always full, so no change is needed there.  New partial
blob creations need to indicate which parts aren't yet used.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc

index 2470d5ea9f0641be0fa5ea011445c18d63c43db6..b246156178d53ea09748ba740ad1ba0ff876f044 100644 (file)
@@ -5447,6 +5447,7 @@ void BlueStore::_do_write_small(
       bluestore_lextent_t& lex = o->onode.extent_map[offset] =
        bluestore_lextent_t(blob, b_off + head_pad, length, 0);
       b->ref_map.get(lex.offset, lex.length);
+      b->mark_used(lex.offset, lex.length);
       dout(20) << __func__ << "  lex 0x" << std::hex << offset << std::dec
               << ": " << lex << dendl;
       dout(20) << __func__ << "  old " << blob << ": " << *b << dendl;
@@ -5510,6 +5511,7 @@ void BlueStore::_do_write_small(
       bluestore_lextent_t& lex = o->onode.extent_map[offset] =
        bluestore_lextent_t(blob, offset - bstart, length, 0);
       b->ref_map.get(lex.offset, lex.length);
+      b->mark_used(lex.offset, lex.length);
       dout(20) << __func__ << "  lex 0x" << std::hex << offset
               << std::dec << ": " << lex << dendl;
       dout(20) << __func__ << "  old " << blob << ": " << *b << dendl;
@@ -5526,6 +5528,10 @@ void BlueStore::_do_write_small(
   uint64_t b_off = offset % min_alloc_size;
   uint64_t b_len = length;
   _pad_zeros(txc, o, &bl, &b_off, &b_len, block_size);
+  if (b_off)
+    b->add_unused(0, b_off);
+  if (b_off + b_len < b->length)
+    b->add_unused(b_off + b_len, b->length - (b_off + b_len));
   o->onode.punch_hole(offset, length, &wctx->lex_old);
   bluestore_lextent_t& lex = o->onode.extent_map[offset] =
     bluestore_lextent_t(blob, offset % min_alloc_size, length);