From: Sage Weil Date: Fri, 24 Jun 2016 12:56:44 +0000 (-0400) Subject: os/bluestore: simplify and fix blob invalidation X-Git-Tag: v11.0.0~46^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F9921%2Fhead;p=ceph.git os/bluestore: simplify and fix blob invalidation 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 --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 8b13695e6a50..30125306aed7 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5919,19 +5919,13 @@ void BlueStore::_wctx_finish( vector 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;