From 00a71a0740f16ee643fc7dbfd16428bae425518f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 28 Mar 2016 15:35:43 -0400 Subject: [PATCH] os/bluestore: _do_write: only use append case for aligned eof The append case here only works if the EOF was aligned and there is thus no partial-block zeroing we need to do. If the condition fails, we fall through to the generic WAL path below. Signed-off-by: Sage Weil --- src/os/bluestore/BlueStore.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index e9b6b0f780bdf..f2ac814f2feb9 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5475,11 +5475,11 @@ int BlueStore::_do_write( assert(offset >= bp->first); assert(offset + length <= bp->first + bp->second.length); - // (pad and) overwrite unused portion of extent for an append? + // overwrite unused portion of extent for an append? if (offset > bp->first && - offset >= o->onode.size && // past eof + - (offset / block_size != (o->onode.size - 1) / block_size)) {// diff block - dout(20) << __func__ << " append" << dendl; + offset >= o->onode.size && // past eof + + (o->onode.size & ~block_mask) == 0) { // eof was aligned + dout(20) << __func__ << " append after aligned eof" << dendl; _pad_zeros(txc, o, &bl, &offset, &length, block_size); assert(offset % block_size == 0); assert(length % block_size == 0); -- 2.47.3