]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: fix buffer discard accounting for 2Q
authorSage Weil <sage@redhat.com>
Thu, 23 Jun 2016 21:08:32 +0000 (17:08 -0400)
committerIgor Fedotov <ifedotov@mirantis.com>
Fri, 24 Jun 2016 13:13:52 +0000 (16:13 +0300)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc

index 0131f1fc1edfbbf33f3726eaea3c276b1548bfad..359de96cbdc5372887a5d8b3136bb935b5d46e00 100644 (file)
@@ -798,6 +798,7 @@ void BlueStore::BufferSpace::_clear()
 int BlueStore::BufferSpace::_discard(uint64_t offset, uint64_t length)
 {
   // note: we already hold cache->lock
+  dout(20) << __func__ << std::hex << " 0x" << offset << "~" << length << dendl;
   int cache_private = 0;
   cache->_audit("discard start");
   auto i = _data_lower_bound(offset);
@@ -822,13 +823,17 @@ int BlueStore::BufferSpace::_discard(uint64_t offset, uint64_t length)
        } else {
          _add_buffer(new Buffer(this, b->state, b->seq, end, tail), 0, b);
        }
-       cache->_adjust_buffer_size(b, front - (int64_t)b->length);
+       if (!b->is_writing()) {
+         cache->_adjust_buffer_size(b, front - (int64_t)b->length);
+       }
        b->truncate(front);
        cache->_audit("discard end 1");
        break;
       } else {
        // drop tail
-       cache->_adjust_buffer_size(b, front - (int64_t)b->length);
+       if (!b->is_writing()) {
+         cache->_adjust_buffer_size(b, front - (int64_t)b->length);
+       }
        b->truncate(front);
        ++i;
        continue;