From 12d1404125561b467696ddeccea59a1cb408597a Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Thu, 23 Jan 2020 14:51:54 -0500 Subject: [PATCH] lib/blob: set default use_extent_table to true Extent table and extent page descriptors are now set to be default way clusters are serialized on disk. With this patch UT are ran with and without extent table. Changed two asserts in test, since amount is dependent on which type of serialization is used. Signed-off-by: Tomasz Zawadzki Change-Id: Ica58fce6a4effd014d7dd40ee26edd0fa3196d0f Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481901 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker Reviewed-by: Paul Luse --- lib/blob/blobstore.c | 2 +- test/unit/lib/blob/blob.c/blob_ut.c | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index 5ada556b9..7394baf82 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -209,7 +209,7 @@ spdk_blob_opts_init(struct spdk_blob_opts *opts) opts->thin_provision = false; opts->clear_method = BLOB_CLEAR_WITH_DEFAULT; _spdk_blob_xattrs_init(&opts->xattrs); - opts->use_extent_table = false; + opts->use_extent_table = true; } void diff --git a/test/unit/lib/blob/blob.c/blob_ut.c b/test/unit/lib/blob/blob.c/blob_ut.c index eb1861046..355c891b7 100644 --- a/test/unit/lib/blob/blob.c/blob_ut.c +++ b/test/unit/lib/blob/blob.c/blob_ut.c @@ -4750,7 +4750,12 @@ blob_thin_prov_rw(void) CU_ASSERT(free_clusters - 1 == spdk_bs_free_cluster_count(bs)); /* For thin-provisioned blob we need to write 20 pages plus one page metadata and * read 0 bytes */ - CU_ASSERT(g_dev_write_bytes - write_bytes == page_size * 21); + if (g_use_extent_table) { + /* Add one more page for EXTENT_PAGE write */ + CU_ASSERT(g_dev_write_bytes - write_bytes == page_size * 22); + } else { + CU_ASSERT(g_dev_write_bytes - write_bytes == page_size * 21); + } CU_ASSERT(g_dev_read_bytes - read_bytes == 0); spdk_blob_io_read(blob, channel, payload_read, 4, 10, blob_op_complete, NULL); @@ -4849,7 +4854,12 @@ blob_thin_prov_rle(void) CU_ASSERT(free_clusters - 1 == spdk_bs_free_cluster_count(bs)); /* For thin-provisioned blob we need to write 10 pages plus one page metadata and * read 0 bytes */ - CU_ASSERT(g_dev_write_bytes - write_bytes == page_size * 11); + if (g_use_extent_table) { + /* Add one more page for EXTENT_PAGE write */ + CU_ASSERT(g_dev_write_bytes - write_bytes == page_size * 12); + } else { + CU_ASSERT(g_dev_write_bytes - write_bytes == page_size * 11); + } CU_ASSERT(g_dev_read_bytes - read_bytes == 0); spdk_blob_io_read(blob, channel, payload_read, io_unit, 10, blob_op_complete, NULL); @@ -5226,7 +5236,12 @@ blob_snapshot_rw(void) /* For a clone we need to allocate and copy one cluster, update one page of metadata * and then write 10 pages of payload. */ - CU_ASSERT(g_dev_write_bytes - write_bytes == page_size * 11 + cluster_size); + if (g_use_extent_table) { + /* Add one more page for EXTENT_PAGE write */ + CU_ASSERT(g_dev_write_bytes - write_bytes == page_size * 12 + cluster_size); + } else { + CU_ASSERT(g_dev_write_bytes - write_bytes == page_size * 11 + cluster_size); + } CU_ASSERT(g_dev_read_bytes - read_bytes == cluster_size); spdk_blob_io_read(blob, channel, payload_read, 4, 10, blob_op_complete, NULL); @@ -7728,6 +7743,9 @@ int main(int argc, char **argv) g_use_extent_table = false; CU_basic_run_tests(); num_failures = CU_get_number_of_failures(); + g_use_extent_table = true; + CU_basic_run_tests(); + num_failures += CU_get_number_of_failures(); CU_cleanup_registry(); free(g_dev_buffer);