From c3ea935180a1cc43b6269a592c0f76a10fe077ac Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Mon, 19 Sep 2016 18:30:46 +0800 Subject: [PATCH] os/bluestore: simplify marking unused logic of blob tail Signed-off-by: xie xingguo --- src/os/bluestore/BlueStore.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index c0b36b08b6ab4..2035f7ff660d6 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -7352,13 +7352,12 @@ int BlueStore::_do_alloc_write( } if (wi.mark_unused) { auto b_off = wi.b_off; - auto b_len = wi.bl.length(); + auto b_end = b_off + wi.bl.length(); if (b_off) { b->dirty_blob().add_unused(0, b_off); } - if (b_off + b_len < wi.blob_length) { - b->dirty_blob().add_unused(b_off + b_len, - wi.blob_length - (b_off + b_len)); + if (b_end < wi.blob_length) { + b->dirty_blob().add_unused(b_end, wi.blob_length - b_end); } } -- 2.39.5