#define LPURGE_HIST_MAX 16
static struct lpurge_slot lpurge_hist[LPURGE_HIST_MAX];
-struct stats {
+static struct stats {
unsigned long long s_scan_time;
unsigned long s_scans;
unsigned long s_fast_scans;
unsigned long s_slow_scans;
- unsigned long s_queued; /* # files queued for purge */
- unsigned long s_started; /* # files dequeued for purge by worker */
- unsigned long s_purged; /* # files we successfully purged */
- unsigned long s_failed; /* # files we failed to purge */
- /* TODO count mirrors we tried to purge but found last non stale */
-};
-static struct stats stats;
+ unsigned long s_queued; /* # files queued for purge */
+ unsigned long s_started; /* # files dequeued for purge by worker */
+ unsigned long s_purged; /* # files successfully purged */
+ unsigned long s_purged1; /* # files successfully purged in one period */
+ unsigned long s_purged1_kb; /* purged KB in one period*/
+ unsigned long s_failed; /* # files failed to purge */
+ unsigned long s_failed1; /* # files failed to purge in one period */
+ unsigned long s_failed1_kb; /* total not purged KB */
+ unsigned long s_stale_mirror1; /* # stale mirror not purged in one period */
+ unsigned long s_stale_mirror1_kb; /* # stale mirror KB not purged in one period */
+} stats;
#define DEF_MIN_USED 10 /* 100 - DEF_FREEHI */
#define DEF_MAX_USED 25 /* 100 - DEF_FREELO */
pthread_mutex_unlock(&lpurge_work_lock);
rc = lpurge_mirror_delete(&lo->lo_fid, lo->lo_mirror_id);
- free(lo);
pthread_mutex_lock(&lpurge_work_lock);
- if (rc < 0)
+ if (rc < 0) {
stats.s_failed++;
- else
+ stats.s_failed1++;
+ stats.s_failed1_kb += lo->lo_used_kb;
+ if (rc == -EUCLEAN) {
+ stats.s_stale_mirror1++;
+ stats.s_stale_mirror1_kb += lo->lo_used_kb;
+ }
+ } else {
stats.s_purged++;
+ stats.s_purged1++;
+ stats.s_purged1_kb += lo->lo_used_kb;
+ }
+
+ free(lo);
assert(stats.s_purged + stats.s_failed <= stats.s_queued);
lpurge_purge_slot(ls, used_kb - lpurge_min_used_kb);
}
+ LX_INFO("purged: %lu (%lu KB) failed: %lu (%lu KB) stale: %lu (%lu KB)\n",
+ stats.s_purged1, stats.s_purged1_kb,
+ stats.s_failed1, stats.s_failed1_kb,
+ stats.s_stale_mirror1, stats.s_stale_mirror1_kb);
+ stats.s_purged1 = 0;
+ stats.s_purged1_kb = 0;
+ stats.s_failed1 = 0;
+ stats.s_failed1_kb = 0;
+ stats.s_stale_mirror1 = 0;
+ stats.s_stale_mirror1_kb = 0;
+
rc = lpurge_get_used_kb(&used_kb);
if (!rc)
LX_INFO("used_kb = %llu\n", used_kb);