You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2018/04/16 21:05:01 UTC
[trafficserver] 02/03: Fix cache_read_busy_success_stat
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 75b0444cbacd583285490eb7ef11d6f62630b483
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Thu Apr 12 15:43:46 2018 +0900
Fix cache_read_busy_success_stat
The stat was incremented unintentionally in a certain case.
(cherry picked from commit d52f317f704bc87ba2ef223c2a6437df308eabf1)
---
iocore/cache/CacheRead.cc | 3 ++-
iocore/cache/P_CacheInternal.h | 32 ++++++++++++++++++++------------
2 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index 6b2fbee..7f77ed2 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -908,8 +908,9 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS
Lcallreturn:
return handleEvent(AIO_EVENT_DONE, nullptr); // hopefully a tail call
Lsuccess:
- if (write_vc)
+ if (write_vc) {
CACHE_INCREMENT_DYN_STAT(cache_read_busy_success_stat);
+ }
SET_HANDLER(&CacheVC::openReadMain);
return callcont(CACHE_EVENT_OPEN_READ);
}
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index d8bc466..53782e8 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -168,23 +168,31 @@ extern RecRawStatBlock *cache_rsb;
#define CACHE_SET_DYN_STAT(x, y) \
RecSetGlobalRawStatSum(cache_rsb, (x), (y)) RecSetGlobalRawStatSum(vol->cache_vol->vol_rsb, (x), (y))
-#define CACHE_INCREMENT_DYN_STAT(x) \
- RecIncrRawStat(cache_rsb, mutex->thread_holding, (int)(x), 1); \
- RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), 1);
+#define CACHE_INCREMENT_DYN_STAT(x) \
+ do { \
+ RecIncrRawStat(cache_rsb, mutex->thread_holding, (int)(x), 1); \
+ RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), 1); \
+ } while (0);
-#define CACHE_DECREMENT_DYN_STAT(x) \
- RecIncrRawStat(cache_rsb, mutex->thread_holding, (int)(x), -1); \
- RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), -1);
+#define CACHE_DECREMENT_DYN_STAT(x) \
+ do { \
+ RecIncrRawStat(cache_rsb, mutex->thread_holding, (int)(x), -1); \
+ RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), -1); \
+ } while (0);
#define CACHE_VOL_SUM_DYN_STAT(x, y) RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), (int64_t)y);
-#define CACHE_SUM_DYN_STAT(x, y) \
- RecIncrRawStat(cache_rsb, mutex->thread_holding, (int)(x), (int64_t)(y)); \
- RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), (int64_t)(y));
+#define CACHE_SUM_DYN_STAT(x, y) \
+ do { \
+ RecIncrRawStat(cache_rsb, mutex->thread_holding, (int)(x), (int64_t)(y)); \
+ RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), (int64_t)(y)); \
+ } while (0);
-#define CACHE_SUM_DYN_STAT_THREAD(x, y) \
- RecIncrRawStat(cache_rsb, this_ethread(), (int)(x), (int64_t)(y)); \
- RecIncrRawStat(vol->cache_vol->vol_rsb, this_ethread(), (int)(x), (int64_t)(y));
+#define CACHE_SUM_DYN_STAT_THREAD(x, y) \
+ do { \
+ RecIncrRawStat(cache_rsb, this_ethread(), (int)(x), (int64_t)(y)); \
+ RecIncrRawStat(vol->cache_vol->vol_rsb, this_ethread(), (int)(x), (int64_t)(y)); \
+ } while (0);
#define GLOBAL_CACHE_SUM_GLOBAL_DYN_STAT(x, y) RecIncrGlobalRawStatSum(cache_rsb, (x), (y))
--
To stop receiving notification emails like this one, please contact
zwoop@apache.org.