From a6fae6890004970a9a89117cbc3511d36e24bc52 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Fri, 10 Jan 2014 16:50:49 -0800 Subject: [PATCH] rgw: more rgw_quota fixes Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_quota.cc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/rgw/rgw_quota.cc b/src/rgw/rgw_quota.cc index 6f5f8ea0ba293..c904316a46173 100644 --- a/src/rgw/rgw_quota.cc +++ b/src/rgw/rgw_quota.cc @@ -37,7 +37,7 @@ protected: lru_map stats_map; RefCountedWaitObject *async_refcount; - class StatsAsyncTestSet : public lru_map::UpdateContext { + class StatsAsyncTestSet : public lru_map::UpdateContext { int objs_delta; uint64_t added_bytes; uint64_t removed_bytes; @@ -56,7 +56,8 @@ protected: virtual int fetch_stats_from_storage(const string& user, rgw_bucket& bucket, RGWStorageStats& stats) = 0; virtual bool map_find(const string& user, rgw_bucket& bucket, RGWQuotaCacheStats& qs) = 0; - virtual bool map_find_and_update(const string& user, rgw_bucket& bucket, lru_map::UpdateContext *ctx) = 0; + + virtual bool map_find_and_update(const string& user, rgw_bucket& bucket, typename lru_map::UpdateContext *ctx) = 0; virtual void map_add(const string& user, rgw_bucket& bucket, RGWQuotaCacheStats& qs) = 0; public: RGWQuotaCache(RGWRados *_store, int size) : store(_store), stats_map(size) { @@ -201,7 +202,8 @@ int RGWQuotaCache::get_stats(const string& user, rgw_bucket& bucket, RGWStora } -class RGWQuotaStatsUpdate : public lru_map::UpdateContext { +template +class RGWQuotaStatsUpdate : public lru_map::UpdateContext { int objs_delta; uint64_t added_bytes; uint64_t removed_bytes; @@ -225,7 +227,7 @@ template void RGWQuotaCache::adjust_stats(const string& user, rgw_bucket& bucket, int objs_delta, uint64_t added_bytes, uint64_t removed_bytes) { - RGWQuotaStatsUpdate update(objs_delta, added_bytes, removed_bytes); + RGWQuotaStatsUpdate update(objs_delta, added_bytes, removed_bytes); map_find_and_update(user, bucket, &update); } @@ -330,13 +332,13 @@ int RGWBucketStatsCache::fetch_stats_from_storage(const string& user, rgw_bucket return 0; } -class UserAsyncRefreshHandler : public RGWQuotaCache::AsyncRefreshHandler, +class UserAsyncRefreshHandler : public RGWQuotaCache::AsyncRefreshHandler, public RGWGetUserStats_CB { rgw_bucket bucket; public: - UserAsyncRefreshHandler(RGWRados *_store, RGWQuotaCache *_cache, + UserAsyncRefreshHandler(RGWRados *_store, RGWQuotaCache *_cache, const string& _user, rgw_bucket& _bucket) : - RGWQuotaCache::AsyncRefreshHandler(_store, _cache), + RGWQuotaCache::AsyncRefreshHandler(_store, _cache), RGWGetUserStats_CB(_user), bucket(_bucket) {} @@ -369,13 +371,13 @@ void UserAsyncRefreshHandler::handle_response(int r) cache->async_refresh_response(user, bucket, stats); } -class RGWUserStatsCache : public RGWQuotaCache { +class RGWUserStatsCache : public RGWQuotaCache { protected: bool map_find(const string& user, rgw_bucket& bucket, RGWQuotaCacheStats& qs) { return stats_map.find(user, qs); } - bool map_find_and_update(const string& user, rgw_bucket& bucket, lru_map::UpdateContext *ctx) { + bool map_find_and_update(const string& user, rgw_bucket& bucket, lru_map::UpdateContext *ctx) { return stats_map.find_and_update(user, NULL, ctx); } -- 2.39.5