lib/blob: delay executing blob persist completions

This helps in next patch in series where multiple
completions will be executing.

UT is adjusted since one additional poll is required.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Id72377ddef91e40cdbc2bdea6f33c23309b0ca3d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7642
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Tomasz Zawadzki 2021-04-27 10:17:15 -04:00
parent 958364b4a0
commit a8fe601853
2 changed files with 15 additions and 7 deletions

View File

@ -1619,6 +1619,19 @@ bs_batch_clear_dev(struct spdk_blob_persist_ctx *ctx, spdk_bs_batch_t *batch, ui
static void blob_persist_check_dirty(struct spdk_blob_persist_ctx *ctx);
static void
blob_persist_complete_cb(void *arg)
{
struct spdk_blob_persist_ctx *ctx = arg;
/* Call user callback */
ctx->cb_fn(ctx->seq, ctx->cb_arg, 0);
/* Free the memory */
spdk_free(ctx->pages);
free(ctx);
}
static void
blob_persist_complete(spdk_bs_sequence_t *seq, struct spdk_blob_persist_ctx *ctx, int bserrno)
{
@ -1634,12 +1647,7 @@ blob_persist_complete(spdk_bs_sequence_t *seq, struct spdk_blob_persist_ctx *ctx
next_persist = TAILQ_FIRST(&blob->pending_persists);
/* Call user callback */
ctx->cb_fn(seq, ctx->cb_arg, bserrno);
/* Free the memory */
spdk_free(ctx->pages);
free(ctx);
spdk_thread_send_msg(spdk_get_thread(), blob_persist_complete_cb, ctx);
if (next_persist != NULL) {
blob->state = SPDK_BLOB_STATE_DIRTY;

View File

@ -821,7 +821,7 @@ blob_snapshot_freeze_io(void)
/* This is implementation specific.
* Flag 'frozen_io' is set in _spdk_bs_snapshot_freeze_cpl callback.
* Four async I/O operations happen before that. */
poll_thread_times(0, 4);
poll_thread_times(0, 5);
CU_ASSERT(TAILQ_EMPTY(&bs_channel->queued_io));