Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-16097 vos: assign persistent DTX entry in vos_dtx_prepared #14708

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions src/dtx/dtx_rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,9 @@ dtx_refresh_internal(struct ds_cont_child *cont, int *check_count, d_list_t *che
/* Handle the entries whose leaders are on current server. */
d_list_for_each_entry_safe(dsp, tmp, &self, dsp_link) {
struct dtx_entry dte;
struct dtx_entry *pdte = &dte;
struct dtx_cos_key dck;


d_list_del(&dsp->dsp_link);

Expand All @@ -1228,13 +1231,31 @@ dtx_refresh_internal(struct ds_cont_child *cont, int *check_count, d_list_t *che
dte.dte_refs = 1;
dte.dte_mbs = dsp->dsp_mbs;

if (for_io) {
rc = vos_dtx_check(cont->sc_hdl, &dsp->dsp_xid, NULL, NULL, NULL, false);
switch(rc) {
case DTX_ST_COMMITTABLE:
dck.oid = dsp->dsp_oid;
dck.dkey_hash = dsp->dsp_dkey_hash;
rc = dtx_commit(cont, &pdte, &dck, 1);
if (rc < 0 && rc != -DER_NONEXIST && for_io)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: && for_io seems redundant considering the whole block is under this condition.

d_list_add_tail(&dsp->dsp_link, cmt_list);
else
dtx_dsp_free(dsp);
continue;
case DTX_ST_COMMITTED:
case -DER_NONEXIST: /* Aborted */
dtx_dsp_free(dsp);
continue;
default:
break;
}
}

Comment on lines +1234 to +1254
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not too familiar with this part of DAOS, but it seems to me this change is not explained in the commit message. Or is it?

rc = dtx_status_handle_one(cont, &dte, dsp->dsp_oid, dsp->dsp_dkey_hash,
dsp->dsp_epoch, NULL, NULL);
switch (rc) {
case DSHR_NEED_COMMIT: {
struct dtx_entry *pdte = &dte;
struct dtx_cos_key dck;

dck.oid = dsp->dsp_oid;
dck.dkey_hash = dsp->dsp_dkey_hash;
rc = dtx_commit(cont, &pdte, &dck, 1);
Expand Down
3 changes: 2 additions & 1 deletion src/object/srv_obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -5650,7 +5650,8 @@ ds_obj_coll_punch_handler(crt_rpc_t *rpc)
1 /* start, [0] is for current engine */, ocpi->ocpi_disp_width,
&exec_arg.coll_cur);

rc = dtx_leader_begin(ioc.ioc_vos_coh, &odm->odm_xid, &epoch, 1, version,
rc = dtx_leader_begin(ioc.ioc_vos_coh, &odm->odm_xid, &epoch,
dcts[0].dct_shards[dmi->dmi_tgt_id].dcs_nr, version,
Comment on lines +5653 to +5654
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this bit not referred to in the commit message?

&ocpi->ocpi_oid, NULL /* dti_cos */, 0 /* dti_cos_cnt */,
NULL /* tgts */, exec_arg.coll_cur.grp_nr /* tgt_cnt */,
dtx_flags, odm->odm_mbs, dce, &dlh);
Expand Down
33 changes: 19 additions & 14 deletions src/vos/vos_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,15 @@ vos_tx_end(struct vos_container *cont, struct dtx_handle *dth_in,
struct umem_rsrvd_act **rsrvd_scmp, d_list_t *nvme_exts,
bool started, struct bio_desc *biod, int err)
{
struct vos_pool *pool;
struct dtx_handle *dth = dth_in;
struct vos_dtx_act_ent *dae;
struct dtx_rsrvd_uint *dru;
struct vos_dtx_cmt_ent *dce = NULL;
struct dtx_handle tmp = {0};
int rc;
struct vos_pool *pool;
struct umem_instance *umm;
struct dtx_handle *dth = dth_in;
struct vos_dtx_act_ent *dae;
struct vos_dtx_act_ent_df *dae_df;
struct dtx_rsrvd_uint *dru;
struct vos_dtx_cmt_ent *dce = NULL;
struct dtx_handle tmp = {0};
int rc = 0;

if (!dtx_is_valid_handle(dth)) {
/** Created a dummy dth handle for publishing extents */
Expand All @@ -287,11 +289,11 @@ vos_tx_end(struct vos_container *cont, struct dtx_handle *dth_in,
D_INIT_LIST_HEAD(&tmp.dth_deferred_nvme);
}

if (dth->dth_local) {
if (dth->dth_local)
pool = vos_hdl2pool(dth_in->dth_poh);
} else {
else
pool = cont->vc_pool;
}
umm = vos_pool2umm(pool);

if (rsrvd_scmp != NULL) {
D_ASSERT(nvme_exts != NULL);
Expand All @@ -300,7 +302,7 @@ vos_tx_end(struct vos_container *cont, struct dtx_handle *dth_in,
* Just do your best to release the SCM reservation. Can't handle another
* error while handling one already anyway.
*/
(void)vos_publish_scm(vos_pool2umm(pool), *rsrvd_scmp, false /* publish */);
(void)vos_publish_scm(umm, *rsrvd_scmp, false /* publish */);
D_FREE(*rsrvd_scmp);
*rsrvd_scmp = NULL;
err = -DER_NOMEM;
Expand Down Expand Up @@ -341,9 +343,9 @@ vos_tx_end(struct vos_container *cont, struct dtx_handle *dth_in,
vos_dth_set(NULL, pool->vp_sysdb);

if (bio_nvme_configured(SMD_DEV_TYPE_META) && biod != NULL)
err = umem_tx_end_ex(vos_pool2umm(pool), err, biod);
err = umem_tx_end_ex(umm, err, biod);
else
err = umem_tx_end(vos_pool2umm(pool), err);
err = umem_tx_end(umm, err);

cancel:
if (dtx_is_valid_handle(dth_in)) {
Expand Down Expand Up @@ -409,8 +411,11 @@ vos_tx_end(struct vos_container *cont, struct dtx_handle *dth_in,
vos_dtx_post_handle(cont, &dae, &dce, 1, false, err != 0);
} else {
D_ASSERT(dce == NULL);
if (err == 0)
if (err == 0) {
dae->dae_prepared = 1;
dae_df = umem_off2ptr(umm, dae->dae_df_off);
D_ASSERT(!(dae_df->dae_flags & DTE_INVALID));
}
}
}
}
Expand Down
Loading
Loading