From d44e3ab32e1825ddbc3db544b3e964c9bc5663d7 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Wed, 2 Feb 2022 16:39:14 +0000 Subject: [PATCH] blob: add do/while (false) to blob_request_submit_op_split_next No functional change here, this only prepares this function for some functional changes in the next patch. By adding the do/while loop here we reduce the amount of whitespace changes in the next patch. Signed-off-by: Jim Harris Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11387 (master) (cherry picked from commit b6992a90d3cc91a9389a4c68350c50660fced422) Change-Id: I09d64fd1fb69ee232af1d298619c762e562fdc79 Signed-off-by: Krzysztof Karas Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12463 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris --- lib/blob/blobstore.c | 64 +++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index 20eaeac56..74386b597 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -2552,40 +2552,42 @@ blob_request_submit_op_split_next(void *cb_arg, int bserrno) return; } - op_length = spdk_min(length, bs_num_io_units_to_cluster_boundary(blob, - offset)); + do { + op_length = spdk_min(length, bs_num_io_units_to_cluster_boundary(blob, + offset)); - /* Update length and payload for next operation */ - ctx->io_units_remaining -= op_length; - ctx->io_unit_offset += op_length; - if (op_type == SPDK_BLOB_WRITE || op_type == SPDK_BLOB_READ) { - ctx->curr_payload += op_length * blob->bs->io_unit_size; - } + /* Update length and payload for next operation */ + ctx->io_units_remaining -= op_length; + ctx->io_unit_offset += op_length; + if (op_type == SPDK_BLOB_WRITE || op_type == SPDK_BLOB_READ) { + ctx->curr_payload += op_length * blob->bs->io_unit_size; + } - switch (op_type) { - case SPDK_BLOB_READ: - spdk_blob_io_read(blob, ch, buf, offset, op_length, - blob_request_submit_op_split_next, ctx); - break; - case SPDK_BLOB_WRITE: - spdk_blob_io_write(blob, ch, buf, offset, op_length, - blob_request_submit_op_split_next, ctx); - break; - case SPDK_BLOB_UNMAP: - spdk_blob_io_unmap(blob, ch, offset, op_length, - blob_request_submit_op_split_next, ctx); - break; - case SPDK_BLOB_WRITE_ZEROES: - spdk_blob_io_write_zeroes(blob, ch, offset, op_length, + switch (op_type) { + case SPDK_BLOB_READ: + spdk_blob_io_read(blob, ch, buf, offset, op_length, blob_request_submit_op_split_next, ctx); - break; - case SPDK_BLOB_READV: - case SPDK_BLOB_WRITEV: - SPDK_ERRLOG("readv/write not valid\n"); - bs_sequence_finish(ctx->seq, -EINVAL); - free(ctx); - break; - } + break; + case SPDK_BLOB_WRITE: + spdk_blob_io_write(blob, ch, buf, offset, op_length, + blob_request_submit_op_split_next, ctx); + break; + case SPDK_BLOB_UNMAP: + spdk_blob_io_unmap(blob, ch, offset, op_length, + blob_request_submit_op_split_next, ctx); + break; + case SPDK_BLOB_WRITE_ZEROES: + spdk_blob_io_write_zeroes(blob, ch, offset, op_length, + blob_request_submit_op_split_next, ctx); + break; + case SPDK_BLOB_READV: + case SPDK_BLOB_WRITEV: + SPDK_ERRLOG("readv/write not valid\n"); + bs_sequence_finish(ctx->seq, -EINVAL); + free(ctx); + break; + } + } while (false); } static void