From d9eec0f753df835fdcf9d6e55445f154cbe05b5b Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Tue, 26 Oct 2021 11:38:21 -0500 Subject: [PATCH] EX-3002 lipe: rename lamigo 'target pool' to 'slow pool' sed -i \ -e 's/\bDEF_TARGET_POOL\b/DEF_SLOW_POOL/g' \ -e 's/\bDEF_TGT_FREE\b/DEF_SLOW_POOL_FREE/g' \ -e 's/\btarget pool/slow pool/g' \ -e 's/\btgt_pools\b/slow_pools/g' \ -e 's/\bALR_COLD\b/ALR_SLOW/g' \ -e 's/\bah_pools[1]/ah_pools[ALR_SLOW]/g' \ -e 's/\bar_pools[1]/ar_pools[ALR_SLOW]/g' \ lipe/src/lamigo*.[ch] Adjust hot-pools test_7 accordingly. This change does not add, remove, or rename any command line options. Test-Parameters: trivial testlist=hot-pools Signed-off-by: John L. Hammond Change-Id: I15d2b9b3233bd635a63dfe5f9381b3be3c7e20ed Reviewed-on: https://review.whamcloud.com/45373 Tested-by: jenkins Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Reviewed-by: Jian Yu Tested-by: Maloo Reviewed-on: https://review.whamcloud.com/46117 --- lipe/src/lamigo.c | 84 +++++++++++++++++++++++------------------------ lipe/src/lamigo.h | 4 +-- lipe/src/lamigo_alr.c | 10 +++--- lustre/tests/hot-pools.sh | 2 +- 4 files changed, 50 insertions(+), 50 deletions(-) diff --git a/lipe/src/lamigo.c b/lipe/src/lamigo.c index 55ff466..b61b26d 100644 --- a/lipe/src/lamigo.c +++ b/lipe/src/lamigo.c @@ -77,7 +77,7 @@ #define DEF_AGENT_JOBS 8 #define DEF_MIRROR_CMD "lfs mirror extend -N" #define DEF_FAST_POOL "ddn_ssd" -#define DEF_TARGET_POOL "ddn_hdd" +#define DEF_SLOW_POOL "ddn_hdd" #define DEF_ALR_PERIODS 16 #define DEF_ALR_PERIOD_SECS 10 #define DEF_WARMUP_K 20 /* how fast to warm up / 100 */ @@ -88,7 +88,7 @@ #define DEF_STATFS_REFRESH_INTV 5 /* OST statfs update interval, in seconds */ #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 */ +#define DEF_SLOW_POOL_FREE 10 /* slow pool is open for migration */ /* if available space is greater, in percent */ #define LAMIGO_USERFILE "/var/lib/lamigo-%s.chlg" @@ -115,7 +115,7 @@ static void usage(void) "\t-h, --help, print this help message\n" "\t-H, --heatfn, # of heat function\n" "\t-m, --mdt, MDT to monitor for changes and replicate\n" - "\t--mirror-cmd, how to mirror to target pool (default: '%s')\n" + "\t--mirror-cmd, how to mirror to slow pool (default: '%s')\n" "\t-M, --mount, mountpoint of client used for replication\n" "\t--progress-interval, seconds between status (default: %u)\n" "\t-n, --thread-number, threads scanning MDT (default: %u)\n" @@ -147,7 +147,7 @@ static void usage(void) DEF_PROGRESS_INTV >> 10, DEF_THREAD_COUNT, DEF_FAST_POOL, - DEF_TARGET_POOL, + DEF_SLOW_POOL, LAMIGO_USERFILE, LAMIGO_DUMPFILE, LAMIGO_HEAT_FILE, @@ -157,7 +157,7 @@ static void usage(void) DEF_HOT_FRACTION, DEF_HOT_AFTER_IDLE, DEF_FAST_POOL_FREE, - DEF_TGT_FREE); + DEF_SLOW_POOL_FREE); exit(EXIT_SUCCESS); } @@ -220,7 +220,7 @@ struct options opt = { .o_pool_refresh = DEF_POOL_REFRESH_INTV, .o_statfs_refresh = DEF_STATFS_REFRESH_INTV, .o_src_free = DEF_FAST_POOL_FREE, - .o_tgt_free = DEF_TGT_FREE, + .o_tgt_free = DEF_SLOW_POOL_FREE, .o_progress_interval = DEF_PROGRESS_INTV, .o_alr_extra_args = DEF_ALR_EXTRA_ARGS, .o_alr_periods = DEF_ALR_PERIODS, @@ -324,7 +324,7 @@ static void lamigo_check_hot(void); void lamigo_alr_mirror_cb(struct resync_job *rj, void *cbdata, int rc); struct pool_list *fast_pools; /* fast pools */ -struct pool_list *tgt_pools; /* target pool */ +struct pool_list *slow_pools; /* slow pool */ static void *lamigo_refresh_statfs_thread(void *arg); static inline bool are_agents_busy(void) @@ -500,7 +500,7 @@ static void lamigo_dump_stats_file(void) " open: %d\n", pl->pl_pool, pl->pl_ostnr, pl->pl_avail, pl->pl_total, (int)pl->pl_open); - for (pl = tgt_pools; pl != NULL; pl = pl->pl_next, i++) + for (pl = slow_pools; pl != NULL; pl = pl->pl_next, i++) fprintf(f, "pool %s:\n" " osts: %d\n" " avail: %llu\n" @@ -911,12 +911,12 @@ static int lamigo_striping_is_in_sync(struct lov_user_md *lum, if (ontgt) { if (ontgt != objs_in_mirror) { /* part of this mirror is out of the - * target pool we can't count it as a + * slow pool we can't count it as a * replica */ } else if (stale) { /* all mirror's object are on the - * target pool but some component is + * slow pool but some component is * stale */ resync = AMIGO_RESYNC_RESYNC; @@ -966,8 +966,8 @@ static int lamigo_striping_is_in_sync(struct lov_user_md *lum, mo->mo_need_prefer = true; } - /* mirror has all objects on the target pool - check for resync - * mirror has no all objects on the target pool - create new + /* mirror has all objects on the slow pool - check for resync + * mirror has no all objects on the slow pool - create new * mirror */ k = 0; @@ -998,13 +998,13 @@ static int lamigo_striping_is_in_sync(struct lov_user_md *lum, /* subject to replication */ if (ontgt) { if (ontgt != objs_in_mirror) { - /* part of this mirror is out of the target pool + /* part of this mirror is out of the slow pool * we can't count it as a replica */ resync = AMIGO_RESYNC_EXTEND; stats.s_extend_by_target++; } else if (stale) { - /* all mirror's object are on the target pool + /* all mirror's object are on the slow pool * but some component is stale */ resync = AMIGO_RESYNC_RESYNC; @@ -1336,12 +1336,12 @@ static int lamigo_update_one(struct fid_rec *f) int resync, rc; struct alr_heat ah; - if (tgt_pools->pl_open == 0) { + if (slow_pools->pl_open == 0) { /* cold pool is close to full, skip replication */ /* do this check before expensive layout fetching, rules, etc */ stats.s_skip_tgt_closed++; LX_DEBUG("pool %s closed for "DFID"\n", - tgt_pools->pl_pool, PFID(&f->fr_fh.fh_fid)); + slow_pools->pl_pool, PFID(&f->fr_fh.fh_fid)); return 0; } @@ -1366,7 +1366,7 @@ static int lamigo_update_one(struct fid_rec *f) } } - resync = lamigo_is_in_sync(&f->fr_fh.fh_fid, fast_pools, tgt_pools, &mo); + resync = lamigo_is_in_sync(&f->fr_fh.fh_fid, fast_pools, slow_pools, &mo); /* check for a mirror */ if (resync == AMIGO_RESYNC_NONE) { /* nothing to do */ @@ -1971,7 +1971,7 @@ void lamigo_refresh_pools(void) pl = pl->pl_next; } - pl = tgt_pools; + pl = slow_pools; while (pl) { lamigo_refresh_osts_from_pool(pl); pl = pl->pl_next; @@ -2353,21 +2353,21 @@ void lamigo_parse_opts(int argc, char **argv) } if (opt.o_tgt_pool == NULL) { - opt.o_tgt_pool = DEF_TARGET_POOL; - LX_WARN("target pool is not defined, using %s\n", opt.o_tgt_pool); + opt.o_tgt_pool = DEF_SLOW_POOL; + LX_WARN("slow pool is not defined, using %s\n", opt.o_tgt_pool); } opt.o_tgt_pool_len = strlen(opt.o_tgt_pool); if (lamigo_lookup_fast_pool(opt.o_tgt_pool)) - LX_FATAL("target pool '%s' cannot also be fast pool\n", + LX_FATAL("slow pool '%s' cannot also be fast pool\n", opt.o_tgt_pool); if (lipe_list_empty(&lamigo_agent_list)) LX_FATAL("no agents configured\n"); - LX_DEBUG("target pool: %s/%d\n", opt.o_tgt_pool, + LX_DEBUG("slow pool: %s/%d\n", opt.o_tgt_pool, opt.o_tgt_pool_len); - tgt_pools = lamigo_alloc_pool(opt.o_tgt_pool); + slow_pools = lamigo_alloc_pool(opt.o_tgt_pool); if (!opt.o_dump_file) { snprintf(buf, sizeof(buf), LAMIGO_DUMPFILE, opt.o_mdtname); @@ -2418,7 +2418,7 @@ static int lamigo_create_job(struct lu_fid *fid, rj->rj_fid = *fid; rj->rj_stripes = mo->mo_stripes; rj->rj_resync = resync; - rj->rj_pool = tgt_pools->pl_pool; + rj->rj_pool = slow_pools->pl_pool; rj->rj_callback = lamigo_alr_mirror_cb; return lamigo_submit_job(rj); @@ -2484,7 +2484,7 @@ int lamigo_lipe_callback(struct lipe_instance *instance, } resync = lamigo_striping_is_in_sync((void *)attrs->loa_lum, fast_pools, - tgt_pools, &mo); + slow_pools, &mo); if (resync == AMIGO_RESYNC_NONE) { lamigo_hist_add(&attrs->loa_fid, resync); return 0; @@ -3152,13 +3152,13 @@ int main(int argc, char **argv) /* create and lock pidfile to protect against another instance */ lamigo_lock_pidfile(); - /* wait till the target pool got one OST at least */ - lamigo_refresh_osts_from_pool(tgt_pools); - while (tgt_pools->pl_ostnr == 0) { - LX_ERROR("target pool '%s' is empty, waiting %d seconds\n", - tgt_pools->pl_pool, opt.o_pool_refresh); + /* wait till the slow pool got one OST at least */ + lamigo_refresh_osts_from_pool(slow_pools); + while (slow_pools->pl_ostnr == 0) { + LX_ERROR("slow pool '%s' is empty, waiting %d seconds\n", + slow_pools->pl_pool, opt.o_pool_refresh); sleep(opt.o_pool_refresh); - lamigo_refresh_osts_from_pool(tgt_pools); + lamigo_refresh_osts_from_pool(slow_pools); } /* refresh fast pools */ @@ -3259,7 +3259,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[ALR_FAST], - ht->ah_pools[1], ht->ah_livetime, ht->ah_idle, + ht->ah_pools[ALR_SLOW], ht->ah_livetime, ht->ah_idle, ht->ah_mark ? "M" : ""); if (ht->ah_mark & ALR_TAG_PROCESSED) { /* already tried to replicate */ @@ -3274,8 +3274,8 @@ 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[ALR_FAST] == 0 && ht->ah_pools[1]) { - sync = lamigo_is_in_sync(&ht->ah_fid, tgt_pools, fast_pools, &mo); + ht->ah_pools[ALR_FAST] == 0 && ht->ah_pools[ALR_SLOW]) { + sync = lamigo_is_in_sync(&ht->ah_fid, slow_pools, fast_pools, &mo); LX_DEBUG("try to replicate RO "DFID": %d\n", PFID(&ht->ah_fid), sync); if (sync != AMIGO_RESYNC_NONE) { @@ -3293,8 +3293,8 @@ 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[ALR_FAST] == 0 && ht->ah_pools[1]) { - sync = lamigo_is_in_sync(&ht->ah_fid, tgt_pools, fast_pools, &mo); + ht->ah_pools[ALR_FAST] == 0 && ht->ah_pools[ALR_SLOW]) { + sync = lamigo_is_in_sync(&ht->ah_fid, slow_pools, fast_pools, &mo); LX_DEBUG("try to replicate RW "DFID": %d\n", PFID(&ht->ah_fid), sync); if (sync != AMIGO_RESYNC_NONE) { @@ -3318,14 +3318,14 @@ 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[ALR_FAST]) { + ht->ah_pools[ALR_SLOW] == 0 && ht->ah_pools[ALR_FAST]) { sync = lamigo_is_in_sync(&ht->ah_fid, fast_pools, - tgt_pools, &mo); + slow_pools, &mo); LX_DEBUG("replicate idling hot to CP "DFID": %d\n", PFID(&ht->ah_fid), sync); if (sync != AMIGO_RESYNC_NONE) { lamigo_new_job_for_hot(&ht->ah_fid, sync, - tgt_pools, mo.mo_stripes); + slow_pools, mo.mo_stripes); stats.s_replicate_rw2cold++; } /* XXX: mark existing replica preferred if it's not */ @@ -3400,11 +3400,11 @@ 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[ALR_FAST], ah->ah_pools[1], + PFID(&ah->ah_fid), ah->ah_pools[ALR_FAST], ah->ah_pools[ALR_SLOW], ah->ah_livetime, ah->ah_idle); if (fast_pools->pl_open) lamigo_check_hot_one(ht + i); - if (tgt_pools->pl_open) + if (slow_pools->pl_open) lamigo_check_hot_on_cold(ht + i); } free(ht); @@ -3499,7 +3499,7 @@ static void lamigo_refresh_statfs(void) lamigo_refresh_pool_statfs(pl, opt.o_src_free); pl = pl->pl_next; } - pl = tgt_pools; + pl = slow_pools; while (pl) { lamigo_refresh_pool_statfs(pl, opt.o_tgt_free); pl = pl->pl_next; diff --git a/lipe/src/lamigo.h b/lipe/src/lamigo.h index 1beef4a..fcaf646 100644 --- a/lipe/src/lamigo.h +++ b/lipe/src/lamigo.h @@ -15,7 +15,7 @@ void lamigo_alr_init(void); enum alr_pool { ALR_FAST = 0, - ALR_COLD = 1, + ALR_SLOW = 1, ALR_NONE = 2, }; @@ -46,7 +46,7 @@ bool lamigo_lookup_ost(struct pool_list *pl, int ost); struct pool_list *lamigo_lookup_fast_pool(char *name); extern struct pool_list *fast_pools; /* fast pools */ -extern struct pool_list *tgt_pools; /* target pool */ +extern struct pool_list *slow_pools; /* slow pool */ struct alr_heat { struct lu_fid ah_fid; diff --git a/lipe/src/lamigo_alr.c b/lipe/src/lamigo_alr.c index 9dc0b96..95ecc1f 100644 --- a/lipe/src/lamigo_alr.c +++ b/lipe/src/lamigo_alr.c @@ -192,12 +192,12 @@ void lamigo_alr_parse_one(const char *line) return; } /* fast_pools - "hot" pools - * tgt_pools - "cold" pool */ + * slow_pools - "cold" pool */ pool = ALR_NONE; if (lamigo_lookup_ost(fast_pools, idx)) { pool = ALR_FAST; - } else if (lamigo_lookup_ost(tgt_pools, idx)) { - pool = ALR_COLD; + } else if (lamigo_lookup_ost(slow_pools, idx)) { + pool = ALR_SLOW; } lamigo_alr_update_one(&fid, rw == 'w' ? WRITE : READ, count, iosize, end, pool); @@ -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_FAST], f->ar_pools[ALR_COLD], + f->ar_pools[ALR_FAST], f->ar_pools[ALR_SLOW], (int)alr_head.alh_lidx - f->ar_idx); } #endif @@ -693,7 +693,7 @@ static void lamigo_alr_fill_ht(struct alr_heat *ah, struct alr_rec *f) ah->ah_heat[0] = f->ar_heat[0]; ah->ah_heat[1] = f->ar_heat[1]; ah->ah_pools[ALR_FAST] = f->ar_pools[ALR_FAST]; - ah->ah_pools[1] = f->ar_pools[1]; + ah->ah_pools[ALR_SLOW] = f->ar_pools[ALR_SLOW]; ah->ah_maxoff = f->ar_maxoff[0] > f->ar_maxoff[1] ? f->ar_maxoff[0] : f->ar_maxoff[1]; ah->ah_iosize[0] = f->ar_iosize[0]; diff --git a/lustre/tests/hot-pools.sh b/lustre/tests/hot-pools.sh index ebf4fea..1291561 100755 --- a/lustre/tests/hot-pools.sh +++ b/lustre/tests/hot-pools.sh @@ -1215,7 +1215,7 @@ test_7() { sleep $LAMIGO_AGE do_facet $facet "cat $log_file" | - grep --ignore-case -q "target pool '$tgt_pool' is empty, waiting" || + grep --ignore-case -q "slow pool '$tgt_pool' is empty" || error "failed to use default pool '$tgt_pool'" } run_test 7 "lamigo: start with no OST pools" -- 1.8.3.1