int rj_setprefer;
int rj_check_job;
int rj_stripes;
+ int rj_stripe_size;
char *rj_pool;
char *rj_mirror_opts;
void (*rj_callback)(struct resync_job *, void *, int rc);
struct mirror_opts {
int mo_stripes;
+ int mo_stripe_size;
bool mo_need_prefer;
struct pool_list *mo_src_pool;
};
if (rj->rj_stripes > 0)
i += snprintf(cmd + i, sizeof(cmd) - i,
" --stripe-count=%d", rj->rj_stripes);
+ if (rj->rj_stripe_size > 0)
+ i += snprintf(cmd + i, sizeof(cmd) - i,
+ " --stripe-size=%d", rj->rj_stripe_size);
if (rj->rj_mirror_opts)
i += snprintf(cmd + i, sizeof(cmd) - i,
" --flags='%s'", rj->rj_mirror_opts);
static int lamigo_get_objects(struct lov_user_md_v3 *v3,
struct lov_user_ost_data_v1 **objects,
- int *stripes)
+ int *stripes, int *stripesz)
{
if (v3->lmm_magic == LOV_USER_MAGIC_V1) {
struct lov_user_md_v1 *v1 = (struct lov_user_md_v1 *) v3;
*objects = v1->lmm_objects;
*stripes = v1->lmm_stripe_count;
+ *stripesz = v1->lmm_stripe_size;
} else if (v3->lmm_magic == LOV_USER_MAGIC_V3) {
*objects = v3->lmm_objects;
*stripes = v3->lmm_stripe_count;
+ *stripesz = v3->lmm_stripe_size;
} else {
*objects = NULL;
*stripes = 0;
+ *stripesz = 0;
LX_ERROR("unsupported LOV magic %x\n", v3->lmm_magic);
return -EINVAL;
}
struct lov_comp_md_v1 *comp_v1;
struct lov_user_md_v3 *v3 = (struct lov_user_md_v3 *)lum;
enum amigo_resync_type resync;
- int i, k, rc, onsrc = 0, ontgt = 0, stale, stripes, mirid;
+ int i, k, rc, onsrc = 0, ontgt = 0, stale, stripes, mirid, stripesz = 0;
int objs_in_mirror;
struct pool_list *pl, *found_on;
resync = AMIGO_RESYNC_NONE;
assert(mo);
mo->mo_stripes = 0;
+ mo->mo_stripe_size = 0;
mo->mo_need_prefer = false;
mo->mo_src_pool = NULL;
* then we don't need to check each individual OST
* do replication only for specific pool
*/
- stripes = v3->lmm_stripe_count;
- mo->mo_stripes = stripes;
+ mo->mo_stripes = stripes = v3->lmm_stripe_count;
+ mo->mo_stripe_size = stripesz = v3->lmm_stripe_size;
if ((pl = lamigo_lookup_fast_pool(v3->lmm_pool_name))) {
resync = AMIGO_RESYNC_EXTEND;
mo->mo_src_pool = pl;
if (v3->lmm_magic == LOV_USER_MAGIC_V1 ||
v3->lmm_magic == LOV_USER_MAGIC_V3) {
- rc = lamigo_get_objects(v3, &objects, &stripes);
+ rc = lamigo_get_objects(v3, &objects, &stripes, &stripesz);
if (rc)
goto out;
stats.s_extend_by_objects++;
}
mo->mo_stripes = stripes;
+ mo->mo_stripe_size = stripesz;
goto out;
}
continue;
}
- rc = lamigo_get_objects(v3, &objects, &stripes);
+ rc = lamigo_get_objects(v3, &objects, &stripes, &stripesz);
if (rc) {
stats.s_skip_unknown++;
goto out;
}
/* find largest stripe count */
- if (mo->mo_stripes < stripes)
+ if (mo->mo_stripes < stripes) {
mo->mo_stripes = stripes;
+ mo->mo_stripe_size = stripesz;
+ }
}
if (!onsrc) {
stats.s_extend_by_target++;
}
out:
- if (resync == AMIGO_RESYNC_EXTEND)
+ if (resync == AMIGO_RESYNC_EXTEND) {
mo->mo_stripes = stripes;
+ mo->mo_stripe_size = stripesz;
+ }
return resync;
}
out:
lamigo_hist_add(fid, resync);
- LX_DEBUG("check "DFID" stripes=%d: resync=%d\n",
- PFID(fid), mo->mo_stripes, resync);
+ LX_DEBUG("check "DFID" stripes=%d stripesz=%d: resync=%d\n",
+ PFID(fid), mo->mo_stripes, mo->mo_stripe_size, resync);
return resync;
}
rj = xcalloc(1, sizeof(*rj));
rj->rj_fid = f->fr_fh.fh_fid;
rj->rj_stripes = mo.mo_stripes;
+ rj->rj_stripe_size = mo.mo_stripe_size;
rj->rj_index = f->fr_index;
rj->rj_resync = resync;
rj->rj_pool = opt.o_slow_pool;
rj = xcalloc(1, sizeof(*rj));
rj->rj_fid = *fid;
rj->rj_stripes = mo->mo_stripes;
+ rj->rj_stripe_size = mo->mo_stripe_size;
rj->rj_resync = resync;
rj->rj_pool = slow_pools->pl_pool;
rj->rj_callback = lamigo_alr_mirror_cb;
/* Create and submit a job to @sync (extend or resync) @fid to @pl. */
static void lamigo_submit_sync(const struct lu_fid *fid, enum amigo_resync_type sync,
- struct pool_list *pl, int stripes)
+ struct pool_list *pl, int stripes, int stripesz)
{
struct resync_job *rj;
int rc;
rj = xcalloc(1, sizeof(*rj));
rj->rj_fid = *fid;
rj->rj_stripes = stripes;
+ rj->rj_stripe_size = stripesz;
rj->rj_index = 0;
rj->rj_resync = sync;
rj->rj_check_job = 0;
PFID(&ht->ah_fid),
fast_pools->pl_pool);
- lamigo_submit_sync(&ht->ah_fid, sync, fast_pools, mo.mo_stripes);
+ lamigo_submit_sync(&ht->ah_fid, sync, fast_pools,
+ mo.mo_stripes, mo.mo_stripe_size);
if (is_rw)
stats.s_replicate_rw2hot++;
LX_DEBUG("try to %s idling hot "DFID" to pool '%s'\n",
PSYNC(sync), PFID(&ht->ah_fid), slow_pools->pl_pool);
- lamigo_submit_sync(&ht->ah_fid, sync, slow_pools, mo.mo_stripes);
+ lamigo_submit_sync(&ht->ah_fid, sync, slow_pools,
+ mo.mo_stripes, mo.mo_stripe_size);
stats.s_replicate_rw2cold++;
/* XXX: mark existing replica preferred if it's not */
}