cas/service: add kv pairs to FOL
This is done by moving kv buffer deallocation to cas_fom_fini().
@@ -1702,9 +1702,19 @@ M0_INTERNAL void (*cas__ut_cb_fini)(struct m0_fom *fom);
static void cas_fom_fini(struct m0_fom *fom0)
{
+ struct m0_cas_rec *rec;
+ struct m0_cas_op *op = cas_op(fom0);
struct cas_fom *fom = M0_AMB(fom, fom0, cf_fom);
uint64_t i;
+ for (i = 0; i < op->cg_rec.cr_nr; i++) {
+ rec = cas_at(op, i);
+
+ /* Finalise input AT buffers. */
+ cas_at_fini(&rec->cr_key);
+ cas_at_fini(&rec->cr_val);
+ }
+
if (cas_in_ut() && cas__ut_cb_done != NULL)
cas__ut_cb_done(fom0);
@@ -2395,7 +2405,6 @@ static int cas_done(struct cas_fom *fom, struct m0_cas_op *op,
struct m0_cas_rec *rec;
int ctg_rc = m0_ctg_op_rc(&fom->cf_ctg_op);
int rc;
- bool at_fini = true;
M0_ASSERT(fom->cf_ipos < op->cg_rec.cr_nr);
rec_out = cas_out_at(rep, fom->cf_opos);
@@ -2413,7 +2422,6 @@ static int cas_done(struct cas_fom *fom, struct m0_cas_op *op,
(fom->cf_curpos < rec->cr_rc + 1)))) {
/* Continue with the same iteration. */
--fom->cf_ipos;
- at_fini = false;
} else {
/*
* End the iteration on ctg cursor error because it
@@ -2440,11 +2448,6 @@ static int cas_done(struct cas_fom *fom, struct m0_cas_op *op,
M0_LOG(M0_DEBUG, "pos: %"PRId64" rc: %d", fom->cf_opos, rc);
rec_out->cr_rc = rc;
- if (at_fini) {
- /* Finalise input AT buffers. */
- cas_at_fini(&rec->cr_key);
- cas_at_fini(&rec->cr_val);
- }
/*
* Out buffers are passed to RPC AT layer. They will be deallocated
* automatically as part of a reply FOP.
