]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: reshard on truncate if shards past EOF
authorSage Weil <sage@redhat.com>
Fri, 27 Jan 2017 20:59:23 +0000 (15:59 -0500)
committerSage Weil <sage@redhat.com>
Thu, 2 Feb 2017 15:12:08 +0000 (10:12 -0500)
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 <sage@redhat.com>
src/os/bluestore/BlueStore.cc

index e1cb30946f0d62794a5be4c0e8dc869a11761ba9..806fbbfb90a1646f338ee720228b5891268326c0 100644 (file)
@@ -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;