From 59fa3d6b3971a1e8e276356a7d1ad5cb5afe8e44 Mon Sep 17 00:00:00 2001 From: Rishabh Chawla Date: Wed, 10 Mar 2021 12:05:17 -0800 Subject: [PATCH] os/bluestore: Fix zoned code location in _do_truncate Signed-off-by: Rishabh Chawla --- src/os/bluestore/BlueStore.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index e6d6d520a1571..b377ee736bc84 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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); } -- 2.39.5