From: Sage Weil Date: Fri, 27 Jan 2017 20:59:23 +0000 (-0500) Subject: os/bluestore: reshard on truncate if shards past EOF X-Git-Tag: v12.0.1~489^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c7949d4010812798067f15c6eb847301aa0b0664;p=ceph.git os/bluestore: reshard on truncate if shards past EOF This ensure we mop up shards past EOF instead of encoding them empty and confusing future code (that, say, assumes no shards past EOF). Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index e1cb30946f0d..806fbbfb90a1 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -8826,6 +8826,17 @@ int BlueStore::_do_truncate( o->extent_map.punch_hole(offset, length, &wctx.old_extents); o->extent_map.dirty_range(txc->t, offset, length); _wctx_finish(txc, c, o, &wctx); + + // if we have shards past EOF, ask for a reshard + if (!o->onode.extent_map_shards.empty() && + o->onode.extent_map_shards.back().offset >= offset) { + dout(10) << __func__ << " request reshard past EOF" << dendl; + if (offset) { + o->extent_map.request_reshard(offset - 1, offset + length); + } else { + o->extent_map.request_reshard(0, length); + } + } } o->onode.size = offset;