-
Notifications
You must be signed in to change notification settings - Fork 142
CORTX-27600 dtm0/log: initial implementation for dtx0 and pruner #1503
Changes from 33 commits
a070ccc
e806431
d146763
de3cd39
8740056
0af5a34
0a0b77e
eeda452
280c6fb
853c289
5bde734
3b6fc32
9348b57
f9daba8
6ea23a9
d174b52
5f5b51d
b9c03e6
dc9247c
e1eaf0a
68750a0
5daab8c
d1469c3
55914ba
c86bf22
e24d4f9
9bbf664
f4e3198
ea01602
16f6973
4d8bf3f
cba31ca
47f7eb9
e958f20
0de11bc
37c6187
7c11083
0071454
950b622
bc10854
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ | |
#include "mdservice/fsync_fops.h" /* m0_fsync_fom_ops */ | ||
#include "mdservice/fsync_fops_xc.h" /* m0_fop_fsync_xc */ | ||
#include "cas/client.h" /* m0_cas_sm_conf_init */ | ||
#include "lib/memory.h" /* M0_ALLOC_PTR */ | ||
|
||
struct m0_fom_type_ops; | ||
struct m0_sm_conf; | ||
|
@@ -285,6 +286,63 @@ M0_INTERNAL bool m0_crv_is_none(const struct m0_crv *crv) | |
return memcmp(crv, &M0_CRV_INIT_NONE, sizeof(*crv)) == 0; | ||
} | ||
|
||
M0_INTERNAL bool m0_cas_fop_is_redoable(struct m0_fop *fop) | ||
{ | ||
struct m0_fop_type *cas_fopt = &cas_put_fopt; | ||
return fop->f_type == cas_fopt; | ||
} | ||
|
||
M0_INTERNAL int m0_cas_fop2redo(struct m0_fop *fop, | ||
madhavemuri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
struct m0_dtm0_redo *redo) | ||
{ | ||
struct m0_cas_op *op = m0_fop_data(fop); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to be updated, because now a new data struct is introduced to contain the opcode? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @huanghua78: In this PR only basic log implementation is covered, this will be done as part of separate integration work. |
||
struct m0_buf payload = {}; | ||
int rc; | ||
|
||
/* TODO: encode fop opcode and fop reply as well. */ | ||
|
||
rc = m0_xcode_obj_enc_to_buf(&M0_XCODE_OBJ(m0_cas_op_xc, op), | ||
&payload.b_addr, &payload.b_nob); | ||
if (rc != 0) | ||
return M0_ERR(rc); | ||
|
||
rc = m0_dtm0_redo_init(redo, &op->cg_descriptor, | ||
&payload, M0_DTX0_PAYLOAD_CAS); | ||
if (rc != 0) | ||
m0_buf_free(&payload); | ||
rkothiya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
return M0_RC(rc); | ||
} | ||
|
||
M0_INTERNAL int m0_cas_redo2fop(struct m0_fop *fop, | ||
struct m0_dtm0_redo *redo) | ||
madhavemuri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
struct m0_buf *payload = redo->dtr_payload.dtp_data.ab_elems; | ||
struct m0_cas_op *op; | ||
struct m0_fop_type *cas_fopt; | ||
int rc; | ||
|
||
M0_PRE(redo->dtr_payload.dtp_type == M0_DTX0_PAYLOAD_CAS); | ||
M0_PRE(redo->dtr_payload.dtp_data.ab_count == 1); | ||
|
||
/* TODO: Select the right fop type based on encoded req type. */ | ||
cas_fopt = &cas_put_fopt; | ||
|
||
M0_ALLOC_PTR(op); | ||
if (op == NULL) | ||
return M0_ERR(-ENOMEM); | ||
|
||
rc = m0_xcode_obj_dec_from_buf(&M0_XCODE_OBJ(m0_cas_op_xc, op), | ||
payload->b_addr, payload->b_nob); | ||
if (rc == 0) | ||
m0_fop_init(fop, cas_fopt, op, &m0_fop_release); | ||
else | ||
m0_free(op); | ||
|
||
return M0_RC(rc); | ||
} | ||
|
||
|
||
#undef M0_TRACE_SUBSYSTEM | ||
|
||
/** @} end of cas group */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,8 @@ | |
#include "dix/layout_xc.h" | ||
#include "dtm0/tx_desc.h" /* tx_desc */ | ||
#include "dtm0/tx_desc_xc.h" /* xc for tx_desc */ | ||
#include "dtm0/dtm0.h" /* m0_dtx0_descriptor */ | ||
#include "dtm0/dtm0_xc.h" /* xc for m0_dtx0_descriptor */ | ||
|
||
/** | ||
* @page cas-fspec The catalogue service (CAS) | ||
|
@@ -398,6 +400,12 @@ struct m0_cas_op { | |
* Transaction descriptor associated with CAS operation. | ||
*/ | ||
struct m0_dtm0_tx_desc cg_txd; | ||
|
||
/** | ||
* Transaction descriptor (new DTM0) associated with this CAS | ||
* operation. | ||
*/ | ||
struct m0_dtx0_descriptor cg_descriptor; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The names of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, m0_dtm0_tx_desc() will be removed once we move to new DTM0 completely. |
||
} M0_XCA_RECORD M0_XCA_DOMAIN(rpc); | ||
|
||
/** | ||
|
@@ -475,6 +483,11 @@ M0_INTERNAL void m0_cas__ut_svc_be_set(struct m0_reqh_service *svc, | |
struct m0_be_domain *dom); | ||
M0_INTERNAL struct m0_be_domain * | ||
m0_cas__ut_svc_be_get(struct m0_reqh_service *svc); | ||
struct m0_dtm0_domain; | ||
M0_INTERNAL void m0_cas__ut_svc_dtm0_domain_set(struct m0_reqh_service *svc, | ||
struct m0_dtm0_domain *dod); | ||
M0_INTERNAL struct m0_be_domain * | ||
m0_cas__ut_svc_be_get(struct m0_reqh_service *svc); | ||
M0_INTERNAL int m0_cas_fom_spawn( | ||
struct m0_fom *lead, | ||
struct m0_fom_thralldom *thrall, | ||
|
@@ -542,6 +555,15 @@ M0_INTERNAL struct m0_dtm0_ts m0_crv_ts(const struct m0_crv *crv); | |
M0_INTERNAL void m0_crv_ts_set(struct m0_crv *crv, | ||
const struct m0_dtm0_ts *ts); | ||
|
||
struct m0_fop; | ||
struct m0_dtm0_redo; | ||
|
||
M0_INTERNAL bool m0_cas_fop_is_redoable(struct m0_fop *fop); | ||
M0_INTERNAL int m0_cas_fop2redo(struct m0_fop *fop, | ||
struct m0_dtm0_redo *redo); | ||
M0_INTERNAL int m0_cas_redo2fop(struct m0_fop *fop, | ||
struct m0_dtm0_redo *redo); | ||
|
||
/** @} end of cas_dfspec */ | ||
#endif /* __MOTR_CAS_CAS_H__ */ | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may need to add "del" operation here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@huanghua78: Agree, This can be taken up as part of integration. In this PR only basic log implementation is covered.