From 0408082cdb3b476766e2c681413225f0a730623a Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Mon, 11 Nov 2019 02:34:16 +0300 Subject: [PATCH] os/bluestore: move apply method to bluestore_common.h Signed-off-by: Igor Fedotov --- src/os/bluestore/BlueStore.cc | 15 +------------ src/os/bluestore/bluestore_common.h | 34 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 14 deletions(-) create mode 100755 src/os/bluestore/bluestore_common.h diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 946d4e9a5b9..6e375950cbf 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -22,6 +22,7 @@ #include "include/cpp-btree/btree_set.h" +#include "bluestore_common.h" #include "BlueStore.h" #include "os/kv.h" #include "include/compat.h" @@ -6984,20 +6985,6 @@ int BlueStore::cold_close() return 0; } -static void apply(uint64_t off, - uint64_t len, - uint64_t granularity, - BlueStore::mempool_dynamic_bitset &bitset, - std::function f) { - auto end = round_up_to(off + len, granularity); - while (off < end) { - uint64_t pos = off / granularity; - f(pos, bitset); - off += granularity; - } -} - int _fsck_sum_extents( const PExtentVector& extents, bool compressed, diff --git a/src/os/bluestore/bluestore_common.h b/src/os/bluestore/bluestore_common.h new file mode 100755 index 00000000000..b9b3a4e0535 --- /dev/null +++ b/src/os/bluestore/bluestore_common.h @@ -0,0 +1,34 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2014 Red Hat + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#ifndef CEPH_OSD_BLUESTORE_COMMON_H +#define CEPH_OSD_BLUESTORE_COMMON_H + +#include "include/intarith.h" + +template +void apply(uint64_t off, + uint64_t len, + uint64_t granularity, + Bitset &bitset, + Func f) { + auto end = round_up_to(off + len, granularity); + while (off < end) { + uint64_t pos = off / granularity; + f(pos, bitset); + off += granularity; + } +} + +#endif -- 2.39.5