diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index 0278eab80..d7e3bbb03 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -2612,8 +2612,6 @@ blob_request_submit_op_single(struct spdk_io_channel *_ch, struct spdk_blob *blo cpl.u.blob_basic.cb_fn = cb_fn; cpl.u.blob_basic.cb_arg = cb_arg; - is_allocated = blob_calculate_lba_and_lba_count(blob, offset, length, &lba, &lba_count); - if (blob->frozen_refcnt) { /* This blob I/O is frozen */ spdk_bs_user_op_t *op; @@ -2630,6 +2628,8 @@ blob_request_submit_op_single(struct spdk_io_channel *_ch, struct spdk_blob *blo return; } + is_allocated = blob_calculate_lba_and_lba_count(blob, offset, length, &lba, &lba_count); + switch (op_type) { case SPDK_BLOB_READ: { spdk_bs_batch_t *batch; diff --git a/test/unit/lib/blob/blob.c/blob_ut.c b/test/unit/lib/blob/blob.c/blob_ut.c index a63031bac..1494de29c 100644 --- a/test/unit/lib/blob/blob.c/blob_ut.c +++ b/test/unit/lib/blob/blob.c/blob_ut.c @@ -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, 3); + poll_thread_times(0, 4); CU_ASSERT(TAILQ_EMPTY(&bs_channel->queued_io)); @@ -833,9 +833,8 @@ blob_snapshot_freeze_io(void) /* Verify that I/O is queued */ CU_ASSERT(!TAILQ_EMPTY(&bs_channel->queued_io)); - /* Verify that payload is not written to disk */ - CU_ASSERT(memcmp(payload_zero, &g_dev_buffer[blob->active.clusters[0]*SPDK_BS_PAGE_SIZE], - SPDK_BS_PAGE_SIZE) == 0); + /* Verify that payload is not written to disk, at this point the blobs already switched */ + CU_ASSERT(blob->active.clusters[0] == 0); /* Finish all operations including spdk_bs_create_snapshot */ poll_threads();