From 2423b563686e125cb736ab426199b9c6d49800d3 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Tue, 26 Oct 2021 11:28:39 -0500 Subject: [PATCH] EX-3002 lipe: rename lamigo 'source pool' to 'fast pool' sed -i \ -e 's/\bDEF_SOURCE_POOL\b/DEF_FAST_POOL/g' \ -e 's/\bDEF_SRC_FREE\b/DEF_FAST_POOL_FREE/g' \ -e 's/\bsource pool/fast pool/g' \ -e 's/\bsrc_pools\b/fast_pools/g' \ -e 's/\blamigo_lookup_pool\b/lamigo_lookup_fast_pool/g' \ -e 's/\bALR_HOT\b/ALR_FAST/g' \ -e 's/\bah_pools[0]/ah_pools[ALR_FAST]/g' \ -e 's/\bar_pools[0]/ar_pools[ALR_FAST]/g' \ lipe/src/lamigo*.[ch] This change does not add, remove, or rename any command line options. Test-Parameters: trivial testlist=hot-pools Change-Id: I69599ead28b03bb88519bee11d179625258601f1 Signed-off-by: John L. Hammond Reviewed-on: https://review.whamcloud.com/45372 Reviewed-by: Andreas Dilger Tested-by: jenkins Reviewed-by: Alex Zhuravlev Reviewed-by: Jian Yu Tested-by: Maloo Reviewed-on: https://review.whamcloud.com/46101 --- lipe/src/lamigo.c | 76 +++++++++++++++++++++++++-------------------------- lipe/src/lamigo.h | 6 ++-- lipe/src/lamigo_alr.c | 10 +++---- 3 files changed, 46 insertions(+), 46 deletions(-) diff --git a/lipe/src/lamigo.c b/lipe/src/lamigo.c index 9247be0..55ff466 100644 --- a/lipe/src/lamigo.c +++ b/lipe/src/lamigo.c @@ -76,7 +76,7 @@ #define DEF_THREAD_COUNT 1 #define DEF_AGENT_JOBS 8 #define DEF_MIRROR_CMD "lfs mirror extend -N" -#define DEF_SOURCE_POOL "ddn_ssd" +#define DEF_FAST_POOL "ddn_ssd" #define DEF_TARGET_POOL "ddn_hdd" #define DEF_ALR_PERIODS 16 #define DEF_ALR_PERIOD_SECS 10 @@ -86,7 +86,7 @@ #define DEF_HOT_AFTER_IDLE 3 #define DEF_ALR_EXTRA_ARGS "--exit-on-close" #define DEF_STATFS_REFRESH_INTV 5 /* OST statfs update interval, in seconds */ -#define DEF_SRC_FREE 70 /* source pool is open for migration */ +#define DEF_FAST_POOL_FREE 70 /* fast pool is open for migration */ /* if available space is greater, in percent */ #define DEF_TGT_FREE 10 /* target pool is open for migration */ /* if available space is greater, in percent */ @@ -146,7 +146,7 @@ static void usage(void) DEF_MIRROR_CMD, DEF_PROGRESS_INTV >> 10, DEF_THREAD_COUNT, - DEF_SOURCE_POOL, + DEF_FAST_POOL, DEF_TARGET_POOL, LAMIGO_USERFILE, LAMIGO_DUMPFILE, @@ -156,7 +156,7 @@ static void usage(void) DEF_ALR_PERIOD_SECS, DEF_HOT_FRACTION, DEF_HOT_AFTER_IDLE, - DEF_SRC_FREE, + DEF_FAST_POOL_FREE, DEF_TGT_FREE); exit(EXIT_SUCCESS); } @@ -219,7 +219,7 @@ struct options opt = { .o_num_threads = DEF_THREAD_COUNT, .o_pool_refresh = DEF_POOL_REFRESH_INTV, .o_statfs_refresh = DEF_STATFS_REFRESH_INTV, - .o_src_free = DEF_SRC_FREE, + .o_src_free = DEF_FAST_POOL_FREE, .o_tgt_free = DEF_TGT_FREE, .o_progress_interval = DEF_PROGRESS_INTV, .o_alr_extra_args = DEF_ALR_EXTRA_ARGS, @@ -323,7 +323,7 @@ static int lamigo_read_file(const char *param, char *val, const int vallen); static void lamigo_check_hot(void); void lamigo_alr_mirror_cb(struct resync_job *rj, void *cbdata, int rc); -struct pool_list *src_pools; /* source pools */ +struct pool_list *fast_pools; /* fast pools */ struct pool_list *tgt_pools; /* target pool */ static void *lamigo_refresh_statfs_thread(void *arg); @@ -465,7 +465,7 @@ static void lamigo_dump_stats_file(void) PACKAGE_VERSION, LIPE_RELEASE, LIPE_REVISION, lamigo_changelog_user, opt.o_mdtname, opt.o_mntpt); i = 0; - for (pl = src_pools; pl != NULL; pl = pl->pl_next, i++) + for (pl = fast_pools; pl != NULL; pl = pl->pl_next, i++) fprintf(f, "%s%s", i ? "," : "", pl->pl_pool); fprintf(f, "\n" " target_pool: %s\n" @@ -492,7 +492,7 @@ static void lamigo_dump_stats_file(void) opt.o_alr_cooldown_k, opt.o_alr_ofd_interval, opt.o_alr_hot_fraction, opt.o_alr_hot_after_idle, opt.o_src_free, opt.o_tgt_free, opt.o_src_dom); - for (pl = src_pools; pl != NULL; pl = pl->pl_next, i++) + for (pl = fast_pools; pl != NULL; pl = pl->pl_next, i++) fprintf(f, "pool %s:\n" " osts: %d\n" " avail: %llu\n" @@ -850,7 +850,7 @@ static int lamigo_striping_is_in_sync(struct lov_user_md *lum, */ stripes = v3->lmm_stripe_count; mo->mo_stripes = stripes; - if ((pl = lamigo_lookup_pool(v3->lmm_pool_name))) { + if ((pl = lamigo_lookup_fast_pool(v3->lmm_pool_name))) { resync = AMIGO_RESYNC_EXTEND; mo->mo_src_pool = pl; mo->mo_need_prefer = true; @@ -1324,7 +1324,7 @@ void lamigo_schedule_setprefer(struct resync_job *rj, void *cbdata, int rc) srj->rj_fid = rj->rj_fid; srj->rj_setprefer = 1; /* XXX: few src pools? */ - srj->rj_pool = src_pools->pl_pool; + srj->rj_pool = fast_pools->pl_pool; lipe_list_add_tail(&srj->rj_list, &lamigo_failed_job_list); } @@ -1366,7 +1366,7 @@ static int lamigo_update_one(struct fid_rec *f) } } - resync = lamigo_is_in_sync(&f->fr_fh.fh_fid, src_pools, tgt_pools, &mo); + resync = lamigo_is_in_sync(&f->fr_fh.fh_fid, fast_pools, tgt_pools, &mo); /* check for a mirror */ if (resync == AMIGO_RESYNC_NONE) { /* nothing to do */ @@ -1813,12 +1813,12 @@ static struct option options[] = { static void load_config(char *name); /* - * we've got a list of source pools + * we've got a list of fast pools * each N seconds we refill OST list that list */ -struct pool_list *lamigo_lookup_pool(char *name) +struct pool_list *lamigo_lookup_fast_pool(char *name) { - struct pool_list *pl = src_pools; + struct pool_list *pl = fast_pools; while (pl) { if (strcmp(pl->pl_pool, name) == 0) @@ -1866,7 +1866,7 @@ void lamigo_parse_pool(char *pool) struct pool_list *pl; /* check for duplicates */ - pl = src_pools; + pl = fast_pools; while (pl) { if (strcmp(pl->pl_pool, pool) == 0) return; @@ -1876,8 +1876,8 @@ void lamigo_parse_pool(char *pool) pl = lamigo_alloc_pool(pool); if (!pl) return; - pl->pl_next = src_pools; - src_pools = pl; + pl->pl_next = fast_pools; + fast_pools = pl; } void lamigo_refresh_osts_from_pool(struct pool_list *pl) @@ -1965,7 +1965,7 @@ void lamigo_refresh_pools(void) return; last_time = now; - pl = src_pools; + pl = fast_pools; while (pl) { lamigo_refresh_osts_from_pool(pl); pl = pl->pl_next; @@ -2347,9 +2347,9 @@ void lamigo_parse_opts(int argc, char **argv) if (open_by_fid_fd < 0) LX_FATAL("cannot open '%s': %s\n", buf, strerror(errno)); - if (src_pools == NULL) { - lamigo_parse_pool(DEF_SOURCE_POOL); - LX_WARN("source pools aren't defined, using '%s'\n", DEF_SOURCE_POOL); + if (fast_pools == NULL) { + lamigo_parse_pool(DEF_FAST_POOL); + LX_WARN("fast pools aren't defined, using '%s'\n", DEF_FAST_POOL); } if (opt.o_tgt_pool == NULL) { @@ -2358,8 +2358,8 @@ void lamigo_parse_opts(int argc, char **argv) } opt.o_tgt_pool_len = strlen(opt.o_tgt_pool); - if (lamigo_lookup_pool(opt.o_tgt_pool)) - LX_FATAL("target pool '%s' cannot also be source pool\n", + if (lamigo_lookup_fast_pool(opt.o_tgt_pool)) + LX_FATAL("target pool '%s' cannot also be fast pool\n", opt.o_tgt_pool); if (lipe_list_empty(&lamigo_agent_list)) @@ -2483,7 +2483,7 @@ int lamigo_lipe_callback(struct lipe_instance *instance, goto out; } - resync = lamigo_striping_is_in_sync((void *)attrs->loa_lum, src_pools, + resync = lamigo_striping_is_in_sync((void *)attrs->loa_lum, fast_pools, tgt_pools, &mo); if (resync == AMIGO_RESYNC_NONE) { lamigo_hist_add(&attrs->loa_fid, resync); @@ -3161,7 +3161,7 @@ int main(int argc, char **argv) lamigo_refresh_osts_from_pool(tgt_pools); } - /* refresh source pools */ + /* refresh fast pools */ lamigo_refresh_pools(); /* register changelog before full scan to avoid missing new files */ @@ -3258,7 +3258,7 @@ static int lamigo_check_hot_one(struct alr_heat *ht) LX_DEBUG("check hot "DFID": H: %Lu/%Lu, P: %Lu/%Lu, L %d, I %d %s\n", PFID(&ht->ah_fid), - ht->ah_heat[0], ht->ah_heat[1], ht->ah_pools[0], + ht->ah_heat[0], ht->ah_heat[1], ht->ah_pools[ALR_FAST], ht->ah_pools[1], ht->ah_livetime, ht->ah_idle, ht->ah_mark ? "M" : ""); if (ht->ah_mark & ALR_TAG_PROCESSED) { @@ -3274,12 +3274,12 @@ static int lamigo_check_hot_one(struct alr_heat *ht) * replica preferred */ if (ht->ah_heat[0] && ht->ah_heat[1] == 0 && - ht->ah_pools[0] == 0 && ht->ah_pools[1]) { - sync = lamigo_is_in_sync(&ht->ah_fid, tgt_pools, src_pools, &mo); + ht->ah_pools[ALR_FAST] == 0 && ht->ah_pools[1]) { + sync = lamigo_is_in_sync(&ht->ah_fid, tgt_pools, fast_pools, &mo); LX_DEBUG("try to replicate RO "DFID": %d\n", PFID(&ht->ah_fid), sync); if (sync != AMIGO_RESYNC_NONE) { - lamigo_new_job_for_hot(&ht->ah_fid, sync, src_pools, + lamigo_new_job_for_hot(&ht->ah_fid, sync, fast_pools, mo.mo_stripes); stats.s_replicate_ro2hot++; } @@ -3293,12 +3293,12 @@ static int lamigo_check_hot_one(struct alr_heat *ht) * try if it's still open */ if (ht->ah_idle > 0 && ht->ah_heat[1] && - ht->ah_pools[0] == 0 && ht->ah_pools[1]) { - sync = lamigo_is_in_sync(&ht->ah_fid, tgt_pools, src_pools, &mo); + ht->ah_pools[ALR_FAST] == 0 && ht->ah_pools[1]) { + sync = lamigo_is_in_sync(&ht->ah_fid, tgt_pools, fast_pools, &mo); LX_DEBUG("try to replicate RW "DFID": %d\n", PFID(&ht->ah_fid), sync); if (sync != AMIGO_RESYNC_NONE) { - lamigo_new_job_for_hot(&ht->ah_fid, sync, src_pools, + lamigo_new_job_for_hot(&ht->ah_fid, sync, fast_pools, mo.mo_stripes); stats.s_replicate_rw2hot++; } @@ -3318,8 +3318,8 @@ static void lamigo_check_hot_on_cold(struct alr_heat *ht) /* the file stored on cold pool was hat, * now it's idling, try to move it to hot pool */ if (ht->ah_idle > 0 && ht->ah_heat[1] && - ht->ah_pools[1] == 0 && ht->ah_pools[0]) { - sync = lamigo_is_in_sync(&ht->ah_fid, src_pools, + ht->ah_pools[1] == 0 && ht->ah_pools[ALR_FAST]) { + sync = lamigo_is_in_sync(&ht->ah_fid, fast_pools, tgt_pools, &mo); LX_DEBUG("replicate idling hot to CP "DFID": %d\n", PFID(&ht->ah_fid), sync); @@ -3374,7 +3374,7 @@ static void lamigo_check_hot(void) return; /* don't try to replicate to fast pool if it's close to full */ - if (src_pools->pl_open) { + if (fast_pools->pl_open) { /* get most recent hot files */ ht = lamigo_get_hot(alr_hot_period, &nr); if (ht) { @@ -3400,9 +3400,9 @@ static void lamigo_check_hot(void) for (i = 0; i < nr; i++) { struct alr_heat *ah = ht + i; LX_DEBUG("idle "DFID": P: %Lu/%Lu, live %d, idle %d\n", - PFID(&ah->ah_fid), ah->ah_pools[0], ah->ah_pools[1], + PFID(&ah->ah_fid), ah->ah_pools[ALR_FAST], ah->ah_pools[1], ah->ah_livetime, ah->ah_idle); - if (src_pools->pl_open) + if (fast_pools->pl_open) lamigo_check_hot_one(ht + i); if (tgt_pools->pl_open) lamigo_check_hot_on_cold(ht + i); @@ -3494,7 +3494,7 @@ static void lamigo_refresh_statfs(void) return; last_time = now; - pl = src_pools; + pl = fast_pools; while (pl) { lamigo_refresh_pool_statfs(pl, opt.o_src_free); pl = pl->pl_next; diff --git a/lipe/src/lamigo.h b/lipe/src/lamigo.h index 1d30c0a..1beef4a 100644 --- a/lipe/src/lamigo.h +++ b/lipe/src/lamigo.h @@ -14,7 +14,7 @@ void lamigo_add_alr_agent(const char *host); void lamigo_alr_init(void); enum alr_pool { - ALR_HOT = 0, + ALR_FAST = 0, ALR_COLD = 1, ALR_NONE = 2, }; @@ -43,9 +43,9 @@ enum alr_tag { }; bool lamigo_lookup_ost(struct pool_list *pl, int ost); -struct pool_list *lamigo_lookup_pool(char *name); +struct pool_list *lamigo_lookup_fast_pool(char *name); -extern struct pool_list *src_pools; /* source pools */ +extern struct pool_list *fast_pools; /* fast pools */ extern struct pool_list *tgt_pools; /* target pool */ struct alr_heat { diff --git a/lipe/src/lamigo_alr.c b/lipe/src/lamigo_alr.c index 10ab2e1..9dc0b96 100644 --- a/lipe/src/lamigo_alr.c +++ b/lipe/src/lamigo_alr.c @@ -191,11 +191,11 @@ void lamigo_alr_parse_one(const char *line) LX_ERROR("cannot parse access log OST index '%s'\n", ostidx); return; } - /* src_pools - "hot" pools + /* fast_pools - "hot" pools * tgt_pools - "cold" pool */ pool = ALR_NONE; - if (lamigo_lookup_ost(src_pools, idx)) { - pool = ALR_HOT; + if (lamigo_lookup_ost(fast_pools, idx)) { + pool = ALR_FAST; } else if (lamigo_lookup_ost(tgt_pools, idx)) { pool = ALR_COLD; } @@ -553,7 +553,7 @@ static void lamigo_alr_update_heat_all(void) f->ar_maxoff[0] > f->ar_maxoff[1] ? f->ar_maxoff[0] : f->ar_maxoff[1], f->ar_total_ops[0] > 0 ? f->ar_iosize[0] / f->ar_total_ops[0] : 0, f->ar_total_ops[1] > 0 ? f->ar_iosize[1] / f->ar_total_ops[1] : 0, - f->ar_pools[ALR_HOT], f->ar_pools[ALR_COLD], + f->ar_pools[ALR_FAST], f->ar_pools[ALR_COLD], (int)alr_head.alh_lidx - f->ar_idx); } #endif @@ -692,7 +692,7 @@ static void lamigo_alr_fill_ht(struct alr_heat *ah, struct alr_rec *f) ah->ah_fid = f->ar_fh.fh_fid; ah->ah_heat[0] = f->ar_heat[0]; ah->ah_heat[1] = f->ar_heat[1]; - ah->ah_pools[0] = f->ar_pools[0]; + ah->ah_pools[ALR_FAST] = f->ar_pools[ALR_FAST]; ah->ah_pools[1] = f->ar_pools[1]; ah->ah_maxoff = f->ar_maxoff[0] > f->ar_maxoff[1] ? f->ar_maxoff[0] : f->ar_maxoff[1]; -- 1.8.3.1