]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: simplify and fix blob invalidation 9921/head
authorSage Weil <sage@redhat.com>
Fri, 24 Jun 2016 12:56:44 +0000 (08:56 -0400)
committerSage Weil <sage@redhat.com>
Fri, 24 Jun 2016 12:57:10 +0000 (08:57 -0400)
We can't invalidate based on any particular lextent we drop, as there may
be other lextents (in this onode or in another one) that reference the
same data.  This can break even a single multi-write transaction that
relies on the buffer cache to fill out blocks.

Fix by just doing the unallocated version unconditionally.

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

index 8b13695e6a5009eeaddd03e5ba4c42367d5c6008..30125306aed7c4d8b5599529621fdaab1a597a64 100644 (file)
@@ -5919,19 +5919,13 @@ void BlueStore::_wctx_finish(
     vector<bluestore_pextent_t> r;
     bool compressed = b->blob.is_compressed();
     b->blob.put_ref(l.offset, l.length, min_alloc_size, &r);
-    if (l.blob > 0) {
-      // blob is owned by the onode; invalidate buffers as *we* drop
-      // logical refs.
-      b->bc.discard(l.offset, l.length);
-    } else {
-      // blob is shared.  we can't invalidate our logical extents as
-      // we drop them because other onodes may still reference them.
-      // but we can throw out anything that is no longer allocated.
-      // Note that this will leave behind edge bits that are no
-      // longer referenced but not deallocated (until they age out
-      // of the cache naturally).
-      b->discard_unallocated();
-    }
+    // we can't invalidate our logical extents as we drop them because
+    // other lextents (either in our onode or others) may still
+    // reference them.  but we can throw out anything that is no
+    // longer allocated.  Note that this will leave behind edge bits
+    // that are no longer referenced but not deallocated (until they
+    // age out of the cache naturally).
+    b->discard_unallocated();
     txc->statfs_delta.stored() -= l.length;
     if (compressed) {
       txc->statfs_delta.compressed_original() -= l.length;