From 206b8e2cc6157451d5c7548e294461408e0b0c8f Mon Sep 17 00:00:00 2001 From: Michal Jarzabek Date: Mon, 23 Nov 2015 19:32:55 +0000 Subject: [PATCH] common/buffer: forward declare buffer Signed-off-by: Michal Jarzabek --- src/cls/journal/cls_journal_types.h | 2 +- src/cls/rbd/cls_rbd.h | 2 +- src/common/ConfUtils.h | 2 +- src/common/Formatter.cc | 9 +++++++++ src/common/Formatter.h | 9 ++------- src/common/admin_socket.h | 2 +- src/common/ceph_context.h | 2 +- src/common/ceph_crypto_cms.h | 2 +- src/common/entity_name.h | 2 +- src/common/perf_counters.h | 1 - src/erasure-code/ErasureCode.cc | 1 + src/erasure-code/ErasureCodeInterface.h | 2 +- src/journal/Journaler.h | 2 +- src/kv/KineticStore.h | 2 +- src/kv/LevelDBStore.h | 2 +- src/kv/RocksDBStore.h | 2 +- src/librbd/AioImageRequest.h | 2 +- src/librbd/ImageCtx.h | 2 +- src/librbd/JournalReplay.h | 2 +- src/librbd/WatchNotifyTypes.h | 2 +- src/librbd/internal.h | 2 +- src/mds/CDentry.h | 2 +- src/mds/CDir.h | 2 +- src/mds/Capability.h | 2 +- src/mds/LogEvent.h | 2 +- src/mds/MDSTable.h | 2 +- src/os/DBObjectMap.h | 2 +- src/os/HashIndex.h | 2 +- src/os/Journal.h | 2 +- src/os/WBThrottle.h | 1 - src/osd/ECUtil.cc | 16 ++++++++++++++++ src/osd/ECUtil.h | 17 ++--------------- src/osd/PG.h | 2 +- src/rbd_replay/ActionTypes.h | 2 +- src/rbd_replay/ios.hpp | 2 +- src/test/common/ObjectContents.h | 2 +- src/test/common/test_tableformatter.cc | 2 ++ src/test/librados_test_stub/TestRadosClient.h | 2 +- src/tools/rados/RadosImport.h | 2 +- 39 files changed, 63 insertions(+), 55 deletions(-) diff --git a/src/cls/journal/cls_journal_types.h b/src/cls/journal/cls_journal_types.h index dd38b0d34347b..934873977ecd3 100644 --- a/src/cls/journal/cls_journal_types.h +++ b/src/cls/journal/cls_journal_types.h @@ -5,7 +5,7 @@ #define CEPH_CLS_JOURNAL_TYPES_H #include "include/int_types.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "include/encoding.h" #include #include diff --git a/src/cls/rbd/cls_rbd.h b/src/cls/rbd/cls_rbd.h index 5f79d5a836569..710b54213ff85 100644 --- a/src/cls/rbd/cls_rbd.h +++ b/src/cls/rbd/cls_rbd.h @@ -4,7 +4,7 @@ #define __CEPH_CLS_RBD_H #include "include/types.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "common/Formatter.h" #include "librbd/parent_types.h" diff --git a/src/common/ConfUtils.h b/src/common/ConfUtils.h index e816f68c2a8b2..7a5b79a047a1c 100644 --- a/src/common/ConfUtils.h +++ b/src/common/ConfUtils.h @@ -20,7 +20,7 @@ #include #include -#include "include/buffer.h" +#include "include/buffer_fwd.h" /* * Ceph configuration file support. diff --git a/src/common/Formatter.cc b/src/common/Formatter.cc index 7c166ef09865f..9b5b20303e85c 100644 --- a/src/common/Formatter.cc +++ b/src/common/Formatter.cc @@ -19,6 +19,7 @@ #include "assert.h" #include "Formatter.h" #include "common/escape.h" +#include "include/buffer.h" #include #include @@ -89,6 +90,14 @@ Formatter *Formatter::create(const std::string &type, return (Formatter *) NULL; } + +void Formatter::flush(bufferlist &bl) +{ + std::stringstream os; + flush(os); + bl.append(os.str()); +} + void Formatter::dump_format(const char *name, const char *fmt, ...) { va_list ap; diff --git a/src/common/Formatter.h b/src/common/Formatter.h index 181a0e0a86aee..3c145c8912b2c 100644 --- a/src/common/Formatter.h +++ b/src/common/Formatter.h @@ -14,7 +14,7 @@ #include #include -#include "include/buffer.h" +#include "include/buffer_fwd.h" namespace ceph { @@ -41,12 +41,7 @@ namespace ceph { virtual ~Formatter(); virtual void flush(std::ostream& os) = 0; - void flush(bufferlist &bl) - { - std::stringstream os; - flush(os); - bl.append(os.str()); - } + void flush(bufferlist &bl); virtual void reset() = 0; virtual void open_array_section(const char *name) = 0; diff --git a/src/common/admin_socket.h b/src/common/admin_socket.h index bbbaa2933213b..bad235a277f6e 100644 --- a/src/common/admin_socket.h +++ b/src/common/admin_socket.h @@ -20,7 +20,7 @@ #include #include -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "common/cmdparse.h" class AdminSocket; diff --git a/src/common/ceph_context.h b/src/common/ceph_context.h index 3820a2355ead4..1a6ceafd7fb2e 100644 --- a/src/common/ceph_context.h +++ b/src/common/ceph_context.h @@ -21,7 +21,7 @@ #include #include "include/assert.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "include/atomic.h" #include "common/cmdparse.h" #include "include/Spinlock.h" diff --git a/src/common/ceph_crypto_cms.h b/src/common/ceph_crypto_cms.h index 5b0a7f5950f06..11fb000cae52a 100644 --- a/src/common/ceph_crypto_cms.h +++ b/src/common/ceph_crypto_cms.h @@ -1,7 +1,7 @@ #ifndef CEPH_CRYPTO_CMS_H #define CEPH_CRYPTO_CMS_H -#include "include/buffer.h" +#include "include/buffer_fwd.h" class CephContext; diff --git a/src/common/entity_name.h b/src/common/entity_name.h index 2949f1fa64858..e9329754762c2 100644 --- a/src/common/entity_name.h +++ b/src/common/entity_name.h @@ -20,7 +20,7 @@ #include #include "include/encoding.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "msg/msg_types.h" /* Represents a Ceph entity name. diff --git a/src/common/perf_counters.h b/src/common/perf_counters.h index 34f406768a2b2..74dfa7dab7314 100644 --- a/src/common/perf_counters.h +++ b/src/common/perf_counters.h @@ -18,7 +18,6 @@ #include "common/config_obs.h" #include "common/Mutex.h" -#include "include/buffer.h" #include "include/utime.h" #include diff --git a/src/erasure-code/ErasureCode.cc b/src/erasure-code/ErasureCode.cc index d8d54907eb2ec..6d83d44385fe7 100644 --- a/src/erasure-code/ErasureCode.cc +++ b/src/erasure-code/ErasureCode.cc @@ -22,6 +22,7 @@ #include "common/strtol.h" #include "ErasureCode.h" +#include "include/buffer.h" const unsigned ErasureCode::SIMD_ALIGN = 32; diff --git a/src/erasure-code/ErasureCodeInterface.h b/src/erasure-code/ErasureCodeInterface.h index 5eb55714120d8..3ac2b891b26ba 100644 --- a/src/erasure-code/ErasureCodeInterface.h +++ b/src/erasure-code/ErasureCodeInterface.h @@ -145,7 +145,7 @@ #include #include #include "include/memory.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" class CrushWrapper; diff --git a/src/journal/Journaler.h b/src/journal/Journaler.h index d35821891402e..e43cf1ab9346b 100644 --- a/src/journal/Journaler.h +++ b/src/journal/Journaler.h @@ -5,7 +5,7 @@ #define CEPH_JOURNAL_JOURNALER_H #include "include/int_types.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "include/Context.h" #include "include/rados/librados.hpp" #include "journal/Future.h" diff --git a/src/kv/KineticStore.h b/src/kv/KineticStore.h index 657dfebb451ec..f275b896bfd61 100644 --- a/src/kv/KineticStore.h +++ b/src/kv/KineticStore.h @@ -4,7 +4,7 @@ #define KINETIC_STORE_H #include "include/types.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "KeyValueDB.h" #include #include diff --git a/src/kv/LevelDBStore.h b/src/kv/LevelDBStore.h index c2696011bed1f..2ce421c2fdc54 100644 --- a/src/kv/LevelDBStore.h +++ b/src/kv/LevelDBStore.h @@ -4,7 +4,7 @@ #define LEVEL_DB_STORE_H #include "include/types.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "KeyValueDB.h" #include #include diff --git a/src/kv/RocksDBStore.h b/src/kv/RocksDBStore.h index 90523c451b71c..eb2f157feba31 100644 --- a/src/kv/RocksDBStore.h +++ b/src/kv/RocksDBStore.h @@ -4,7 +4,7 @@ #define ROCKS_DB_STORE_H #include "include/types.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "KeyValueDB.h" #include #include diff --git a/src/librbd/AioImageRequest.h b/src/librbd/AioImageRequest.h index c6037e67e0140..9d29956aefe3d 100644 --- a/src/librbd/AioImageRequest.h +++ b/src/librbd/AioImageRequest.h @@ -5,7 +5,7 @@ #define CEPH_LIBRBD_AIO_IMAGE_REQUEST_H #include "include/int_types.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "common/snap_types.h" #include "osd/osd_types.h" #include "librbd/AioCompletion.h" diff --git a/src/librbd/ImageCtx.h b/src/librbd/ImageCtx.h index 28e8f7455afbc..563d08f4b4e46 100644 --- a/src/librbd/ImageCtx.h +++ b/src/librbd/ImageCtx.h @@ -17,7 +17,7 @@ #include "common/RWLock.h" #include "common/snap_types.h" #include "include/atomic.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "include/rbd/librbd.hpp" #include "include/rbd_types.h" #include "include/types.h" diff --git a/src/librbd/JournalReplay.h b/src/librbd/JournalReplay.h index 62be2dfb36ef8..16532da2cbbb7 100644 --- a/src/librbd/JournalReplay.h +++ b/src/librbd/JournalReplay.h @@ -5,7 +5,7 @@ #define CEPH_LIBRBD_JOURNAL_REPLAY_H #include "include/int_types.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "include/rbd/librbd.hpp" #include "common/Cond.h" #include "common/Mutex.h" diff --git a/src/librbd/WatchNotifyTypes.h b/src/librbd/WatchNotifyTypes.h index 30ab2d0163892..468b45ab475c3 100644 --- a/src/librbd/WatchNotifyTypes.h +++ b/src/librbd/WatchNotifyTypes.h @@ -4,7 +4,7 @@ #define LIBRBD_WATCH_NOTIFY_TYPES_H #include "include/int_types.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "include/encoding.h" #include #include diff --git a/src/librbd/internal.h b/src/librbd/internal.h index 04f5a24e87eac..67ef2e4fcc1d3 100644 --- a/src/librbd/internal.h +++ b/src/librbd/internal.h @@ -10,7 +10,7 @@ #include #include -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "include/rbd/librbd.hpp" #include "include/rbd_types.h" diff --git a/src/mds/CDentry.h b/src/mds/CDentry.h index 171fb3b1c0fd8..7bf21d629bc56 100644 --- a/src/mds/CDentry.h +++ b/src/mds/CDentry.h @@ -21,7 +21,7 @@ #include #include "include/types.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "include/lru.h" #include "include/elist.h" #include "include/filepath.h" diff --git a/src/mds/CDir.h b/src/mds/CDir.h index e161d5ba9c6dd..44034b8d475ff 100644 --- a/src/mds/CDir.h +++ b/src/mds/CDir.h @@ -18,7 +18,7 @@ #define CEPH_CDIR_H #include "include/types.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "mdstypes.h" #include "common/config.h" #include "common/DecayCounter.h" diff --git a/src/mds/Capability.h b/src/mds/Capability.h index 55922ab3711ec..7f1b5b8d81cca 100644 --- a/src/mds/Capability.h +++ b/src/mds/Capability.h @@ -16,7 +16,7 @@ #ifndef CEPH_CAPABILITY_H #define CEPH_CAPABILITY_H -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "include/xlist.h" #include "common/config.h" diff --git a/src/mds/LogEvent.h b/src/mds/LogEvent.h index b3fabf4ad9e54..26bf2797a5151 100644 --- a/src/mds/LogEvent.h +++ b/src/mds/LogEvent.h @@ -42,7 +42,7 @@ #define EVENT_NOOP 51 -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "include/Context.h" #include "include/utime.h" diff --git a/src/mds/MDSTable.h b/src/mds/MDSTable.h index 3eeb8a2b92d6b..904ecfd9ea715 100644 --- a/src/mds/MDSTable.h +++ b/src/mds/MDSTable.h @@ -17,7 +17,7 @@ #include "mdstypes.h" #include "mds_table_types.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" class MDSRank; class Context; diff --git a/src/os/DBObjectMap.h b/src/os/DBObjectMap.h index 00ce46ee86854..4b81acbd94809 100644 --- a/src/os/DBObjectMap.h +++ b/src/os/DBObjectMap.h @@ -2,7 +2,7 @@ #ifndef DBOBJECTMAP_DB_H #define DBOBJECTMAP_DB_H -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include #include #include diff --git a/src/os/HashIndex.h b/src/os/HashIndex.h index cacdbc840f39f..6f5a22d20e337 100644 --- a/src/os/HashIndex.h +++ b/src/os/HashIndex.h @@ -15,7 +15,7 @@ #ifndef CEPH_HASHINDEX_H #define CEPH_HASHINDEX_H -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "include/encoding.h" #include "LFNIndex.h" diff --git a/src/os/Journal.h b/src/os/Journal.h index d5b918698e496..400b1ea8b15f6 100644 --- a/src/os/Journal.h +++ b/src/os/Journal.h @@ -18,7 +18,7 @@ #include -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "include/Context.h" #include "common/Finisher.h" #include "common/TrackedOp.h" diff --git a/src/os/WBThrottle.h b/src/os/WBThrottle.h index d951943a0cef4..fd5a985e362ad 100644 --- a/src/os/WBThrottle.h +++ b/src/os/WBThrottle.h @@ -18,7 +18,6 @@ #include "include/unordered_map.h" #include #include "include/memory.h" -#include "include/buffer.h" #include "common/Formatter.h" #include "common/hobject.h" #include "include/interval_set.h" diff --git a/src/osd/ECUtil.cc b/src/osd/ECUtil.cc index 46a16c379fb43..53fe1a203bf81 100644 --- a/src/osd/ECUtil.cc +++ b/src/osd/ECUtil.cc @@ -137,6 +137,22 @@ int ECUtil::encode( return 0; } +void ECUtil::HashInfo::append(uint64_t old_size, + map &to_append) { + assert(to_append.size() == cumulative_shard_hashes.size()); + assert(old_size == total_chunk_size); + uint64_t size_to_append = to_append.begin()->second.length(); + for (map::iterator i = to_append.begin(); + i != to_append.end(); + ++i) { + assert(size_to_append == i->second.length()); + assert((unsigned)i->first < cumulative_shard_hashes.size()); + uint32_t new_hash = i->second.crc32c(cumulative_shard_hashes[i->first]); + cumulative_shard_hashes[i->first] = new_hash; + } + total_chunk_size += size_to_append; +} + void ECUtil::HashInfo::encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); diff --git a/src/osd/ECUtil.h b/src/osd/ECUtil.h index 08b7f87ed60a4..8e1261c5ebabd 100644 --- a/src/osd/ECUtil.h +++ b/src/osd/ECUtil.h @@ -20,7 +20,7 @@ #include "include/memory.h" #include "erasure-code/ErasureCodeInterface.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "include/assert.h" #include "include/encoding.h" #include "common/Formatter.h" @@ -112,20 +112,7 @@ public: HashInfo(unsigned num_chunks) : total_chunk_size(0), cumulative_shard_hashes(num_chunks, -1) {} - void append(uint64_t old_size, map &to_append) { - assert(to_append.size() == cumulative_shard_hashes.size()); - assert(old_size == total_chunk_size); - uint64_t size_to_append = to_append.begin()->second.length(); - for (map::iterator i = to_append.begin(); - i != to_append.end(); - ++i) { - assert(size_to_append == i->second.length()); - assert((unsigned)i->first < cumulative_shard_hashes.size()); - uint32_t new_hash = i->second.crc32c(cumulative_shard_hashes[i->first]); - cumulative_shard_hashes[i->first] = new_hash; - } - total_chunk_size += size_to_append; - } + void append(uint64_t old_size, map &to_append); void clear() { total_chunk_size = 0; cumulative_shard_hashes = vector( diff --git a/src/osd/PG.h b/src/osd/PG.h index 1c2c31ccc5f93..fad7fa99497d8 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -31,7 +31,7 @@ #include "include/types.h" #include "include/stringify.h" #include "osd_types.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "include/xlist.h" #include "include/atomic.h" #include "SnapMapper.h" diff --git a/src/rbd_replay/ActionTypes.h b/src/rbd_replay/ActionTypes.h index 63ef34e98f2c3..fcceca859ceb3 100644 --- a/src/rbd_replay/ActionTypes.h +++ b/src/rbd_replay/ActionTypes.h @@ -5,7 +5,7 @@ #define CEPH_RBD_REPLAY_ACTION_TYPES_H #include "include/int_types.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "include/encoding.h" #include #include diff --git a/src/rbd_replay/ios.hpp b/src/rbd_replay/ios.hpp index 17559331c7a53..218717b746f70 100644 --- a/src/rbd_replay/ios.hpp +++ b/src/rbd_replay/ios.hpp @@ -18,7 +18,7 @@ // This code assumes that IO IDs and timestamps are related monotonically. // In other words, (a.id < b.id) == (a.timestamp < b.timestamp) for all IOs a and b. -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include #include #include diff --git a/src/test/common/ObjectContents.h b/src/test/common/ObjectContents.h index 8ca410bd33503..0f467b17e7c24 100644 --- a/src/test/common/ObjectContents.h +++ b/src/test/common/ObjectContents.h @@ -1,6 +1,6 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- #include "include/interval_set.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include #ifndef COMMON_OBJECT_H diff --git a/src/test/common/test_tableformatter.cc b/src/test/common/test_tableformatter.cc index 88648f01d73b5..ff99e84374e70 100644 --- a/src/test/common/test_tableformatter.cc +++ b/src/test/common/test_tableformatter.cc @@ -5,6 +5,8 @@ #include #include +using namespace ceph; + TEST(tableformatter, singleline) { std::stringstream sout; diff --git a/src/test/librados_test_stub/TestRadosClient.h b/src/test/librados_test_stub/TestRadosClient.h index d3c20349e74db..b1aa75d790de2 100644 --- a/src/test/librados_test_stub/TestRadosClient.h +++ b/src/test/librados_test_stub/TestRadosClient.h @@ -9,7 +9,7 @@ #include "common/Cond.h" #include "common/Mutex.h" #include "include/atomic.h" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "test/librados_test_stub/TestWatchNotify.h" #include #include diff --git a/src/tools/rados/RadosImport.h b/src/tools/rados/RadosImport.h index 3ce3690842943..3a51663061620 100644 --- a/src/tools/rados/RadosImport.h +++ b/src/tools/rados/RadosImport.h @@ -18,7 +18,7 @@ #include #include "include/rados/librados.hpp" -#include "include/buffer.h" +#include "include/buffer_fwd.h" #include "tools/RadosDump.h" -- 2.39.5