From bea36dbf7da21858996c6a12753948b536e3808d Mon Sep 17 00:00:00 2001 From: shangdehao1 Date: Fri, 15 Mar 2019 02:05:05 +0800 Subject: [PATCH] tools: cleanup code style and delete useless data Signed-off-by: Dehao Shang --- src/tools/immutable_object_cache/CacheClient.h | 2 +- src/tools/immutable_object_cache/CacheController.h | 2 +- src/tools/immutable_object_cache/CacheSession.h | 2 +- src/tools/immutable_object_cache/ObjectCacheStore.cc | 2 +- src/tools/immutable_object_cache/ObjectCacheStore.h | 9 +++++---- src/tools/immutable_object_cache/SimplePolicy.h | 3 --- src/tools/immutable_object_cache/SocketCommon.h | 2 +- src/tools/immutable_object_cache/Types.h | 2 +- src/tools/immutable_object_cache/Utils.h | 2 +- 9 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/tools/immutable_object_cache/CacheClient.h b/src/tools/immutable_object_cache/CacheClient.h index 3d0706ea4d9fd..54a35dec761b5 100644 --- a/src/tools/immutable_object_cache/CacheClient.h +++ b/src/tools/immutable_object_cache/CacheClient.h @@ -79,4 +79,4 @@ class CacheClient { } // namespace immutable_obj_cache } // namespace ceph -#endif +#endif // CEPH_CACHE_CACHE_CLIENT_H diff --git a/src/tools/immutable_object_cache/CacheController.h b/src/tools/immutable_object_cache/CacheController.h index bdb5c8e63fc66..bf5ae07147712 100644 --- a/src/tools/immutable_object_cache/CacheController.h +++ b/src/tools/immutable_object_cache/CacheController.h @@ -37,4 +37,4 @@ class CacheController { } // namespace immutable_obj_cache } // namespace ceph -#endif +#endif // CEPH_CACHE_CACHE_CONTROLLER_H diff --git a/src/tools/immutable_object_cache/CacheSession.h b/src/tools/immutable_object_cache/CacheSession.h index 2e66aa83f351d..575dcf9221d22 100644 --- a/src/tools/immutable_object_cache/CacheSession.h +++ b/src/tools/immutable_object_cache/CacheSession.h @@ -49,4 +49,4 @@ typedef std::shared_ptr CacheSessionPtr; } // namespace immutable_obj_cache } // namespace ceph -#endif +#endif // CEPH_CACHE_SESSION_H diff --git a/src/tools/immutable_object_cache/ObjectCacheStore.cc b/src/tools/immutable_object_cache/ObjectCacheStore.cc index cdd0e91cc5293..8f7dad8797fe7 100644 --- a/src/tools/immutable_object_cache/ObjectCacheStore.cc +++ b/src/tools/immutable_object_cache/ObjectCacheStore.cc @@ -60,7 +60,7 @@ int ObjectCacheStore::init(bool reset) { std::error_code ec; if (efs::exists(m_cache_root_dir)) { // remove all sub folders - for(auto& p: efs::directory_iterator(m_cache_root_dir)) { + for (auto& p : efs::directory_iterator(m_cache_root_dir)) { efs::remove_all(p.path()); } } else { diff --git a/src/tools/immutable_object_cache/ObjectCacheStore.h b/src/tools/immutable_object_cache/ObjectCacheStore.h index aaa8e0bc31e19..6ef977827ec80 100644 --- a/src/tools/immutable_object_cache/ObjectCacheStore.h +++ b/src/tools/immutable_object_cache/ObjectCacheStore.h @@ -36,7 +36,8 @@ class ObjectCacheStore { private: std::string get_cache_file_name(std::string pool_nspace, uint64_t pool_id, uint64_t snap_id, std::string oid); - std::string get_cache_file_path(std::string cache_file_name, bool mkdir = false); + std::string get_cache_file_path(std::string cache_file_name, + bool mkdir = false); int evict_objects(); int do_promote(std::string pool_nspace, uint64_t pool_id, uint64_t snap_id, std::string object_name); @@ -56,6 +57,6 @@ class ObjectCacheStore { std::string m_cache_root_dir; }; -} // namespace ceph -} // namespace immutable_obj_cache -#endif +} // namespace immutable_obje_cache +} // ceph +#endif // CEPH_CACHE_OBJECT_CACHE_STORE_H diff --git a/src/tools/immutable_object_cache/SimplePolicy.h b/src/tools/immutable_object_cache/SimplePolicy.h index 9ff00b26a5202..2b79f0a851d19 100644 --- a/src/tools/immutable_object_cache/SimplePolicy.h +++ b/src/tools/immutable_object_cache/SimplePolicy.h @@ -50,7 +50,6 @@ class SimplePolicy : public Policy { CephContext* cct; float m_watermark; - uint64_t m_entry_count; uint64_t m_max_inflight_ops; uint64_t m_max_cache_size; std::atomic inflight_ops = 0; @@ -58,8 +57,6 @@ class SimplePolicy : public Policy { std::unordered_map m_cache_map; RWLock m_cache_map_lock; - std::deque m_free_list; - std::atomic m_cache_size; LRU m_promoted_lru; diff --git a/src/tools/immutable_object_cache/SocketCommon.h b/src/tools/immutable_object_cache/SocketCommon.h index 4bbc2f611e68d..341550a5ff309 100644 --- a/src/tools/immutable_object_cache/SocketCommon.h +++ b/src/tools/immutable_object_cache/SocketCommon.h @@ -26,4 +26,4 @@ typedef std::function ProcessMsg; } // namespace immutable_obj_cache } // namespace ceph -#endif +#endif // CEPH_CACHE_SOCKET_COMMON_H diff --git a/src/tools/immutable_object_cache/Types.h b/src/tools/immutable_object_cache/Types.h index fb2ef13f4da62..d08cdfedcf8e5 100644 --- a/src/tools/immutable_object_cache/Types.h +++ b/src/tools/immutable_object_cache/Types.h @@ -124,4 +124,4 @@ ObjectCacheRequest* decode_object_cache_request(bufferlist payload_buffer); } // namespace immutable_obj_cache } // namespace ceph -#endif +#endif // CEPH_CACHE_TYPES_H diff --git a/src/tools/immutable_object_cache/Utils.h b/src/tools/immutable_object_cache/Utils.h index 71e716bfc2211..38f6506652493 100644 --- a/src/tools/immutable_object_cache/Utils.h +++ b/src/tools/immutable_object_cache/Utils.h @@ -28,4 +28,4 @@ librados::AioCompletion *create_rados_callback(T *obj) { } // namespace immutable_obj_cache } // namespace ceph -#endif +#endif // CEPH_CACHE_UTILS_H -- 2.39.5