]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: Fix zoned code location in _do_truncate 39994/head
authorRishabh Chawla <rishabhchawla1995@gmail.com>
Wed, 10 Mar 2021 20:05:17 +0000 (12:05 -0800)
committerRishabh Chawla <rishabhchawla1995@gmail.com>
Wed, 10 Mar 2021 20:05:17 +0000 (12:05 -0800)
Signed-off-by: Rishabh Chawla <rishabhchawla1995@gmail.com>
src/os/bluestore/BlueStore.cc

index e6d6d520a157175786bc94f75d66fb4baff4bb19..b377ee736bc84955163fea9909e2b8c65f7596a6 100644 (file)
@@ -14619,6 +14619,15 @@ void BlueStore::_do_truncate(
     o->extent_map.fault_range(db, offset, length);
     o->extent_map.punch_hole(c, offset, length, &wctx.old_extents);
     o->extent_map.dirty_range(offset, length);
+
+    if (bdev->is_smr()) {
+      // On zoned devices, we currently support only removing an object or
+      // truncating it to zero size, both of which fall through this code path.
+      ceph_assert(offset == 0 && !wctx.old_extents.empty());
+      int64_t ondisk_offset = wctx.old_extents.begin()->r.begin()->offset;
+      txc->zoned_note_truncated_object(o, ondisk_offset);
+    }
+
     _wctx_finish(txc, c, o, &wctx, maybe_unshared_blobs);
 
     // if we have shards past EOF, ask for a reshard
@@ -14635,14 +14644,6 @@ void BlueStore::_do_truncate(
 
   o->onode.size = offset;
 
-  if (bdev->is_smr()) {
-    // On zoned devices, we currently support only removing an object or
-    // truncating it to zero size, both of which fall through this code path.
-    ceph_assert(offset == 0 && !wctx.old_extents.empty());
-    int64_t ondisk_offset = wctx.old_extents.begin()->r.begin()->offset;
-    txc->zoned_note_truncated_object(o, ondisk_offset);
-  }
-
   txc->write_onode(o);
 }