From 33a97f2e3f88d55452e4d61964d4752972efe5ab Mon Sep 17 00:00:00 2001 From: Maciej Szwed Date: Wed, 31 Jan 2018 15:58:25 +0100 Subject: [PATCH] blob: print error when dma allocation fails For thin provisioned blobs we allocate dma memory required for copying cluster from backing device. When cluster size is too big dma allocation may fail silently (only IO error). Use PRIu32 to print out the cluster size, and while here, fix two other places that were using %d to print cluster size instead of PRIu32. Signed-off-by: Maciej Szwed Signed-off-by: Jim Harris Change-Id: I098b1a58aee2f0d3f4ead7aa326ecdb63a5b53d8 Reviewed-on: https://review.gerrithub.io/397563 Reviewed-by: Daniel Verkamp Reviewed-by: Ben Walker Tested-by: SPDK Automated Test System --- lib/blob/blobstore.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index e706f2fa8..985840646 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -1355,6 +1355,8 @@ _spdk_bs_allocate_and_copy_cluster(struct spdk_blob_data *blob, ctx->buf = spdk_dma_malloc(blob->bs->cluster_sz, blob->back_bs_dev->blocklen, NULL); if (!ctx->buf) { + SPDK_ERRLOG("DMA allocation for cluster of size = %" PRIu32 " failed.\n", + blob->bs->cluster_sz); free(ctx); spdk_bs_user_op_abort(op); return; @@ -1922,13 +1924,13 @@ _spdk_bs_alloc(struct spdk_bs_dev *dev, struct spdk_bs_opts *opts) dev_size = dev->blocklen * dev->blockcnt; if (dev_size < opts->cluster_sz) { /* Device size cannot be smaller than cluster size of blobstore */ - SPDK_ERRLOG("Device size %" PRIu64 " is smaller than cluster size %d\n", dev_size, - opts->cluster_sz); + SPDK_ERRLOG("Device size %" PRIu64 " is smaller than cluster size %" PRIu32 "\n", + dev_size, opts->cluster_sz); return NULL; } if (opts->cluster_sz < SPDK_BS_PAGE_SIZE) { /* Cluster size cannot be smaller than page size */ - SPDK_ERRLOG("Cluster size %d is smaller than page size %d\n", + SPDK_ERRLOG("Cluster size %" PRIu32 " is smaller than page size %d\n", opts->cluster_sz, SPDK_BS_PAGE_SIZE); return NULL; }