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 <maciej.szwed@intel.com>
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I098b1a58aee2f0d3f4ead7aa326ecdb63a5b53d8

Reviewed-on: https://review.gerrithub.io/397563
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Maciej Szwed 2018-01-31 15:58:25 +01:00 committed by Jim Harris
parent cb5178ea40
commit 33a97f2e3f

View File

@ -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;
}