Skip to content

Commit

Permalink
raid5f: simplify channel creation error handling
Browse files Browse the repository at this point in the history
This also fixes the accel_ch failure case.

Change-Id: I6093c236188630f40072064c6740a9dcd8d28d20
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/18388
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
  • Loading branch information
apaszkie authored and tomzawadzki committed May 29, 2023
1 parent 0a5d8f0 commit 4114b4a
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions module/bdev/raid/raid5f.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,18 +734,17 @@ raid5f_ioch_create(void *io_device, void *ctx_buf)
{
struct raid5f_io_channel *r5ch = ctx_buf;
struct raid5f_info *r5f_info = io_device;
int status = 0;
int i;

TAILQ_INIT(&r5ch->free_stripe_requests);
TAILQ_INIT(&r5ch->xor_retry_queue);

for (i = 0; i < RAID5F_MAX_STRIPES; i++) {
struct stripe_request *stripe_req;

stripe_req = raid5f_stripe_request_alloc(r5ch);
if (!stripe_req) {
status = -ENOMEM;
goto out;
goto err;
}

TAILQ_INSERT_HEAD(&r5ch->free_stripe_requests, stripe_req, link);
Expand All @@ -754,16 +753,14 @@ raid5f_ioch_create(void *io_device, void *ctx_buf)
r5ch->accel_ch = spdk_accel_get_io_channel();
if (!r5ch->accel_ch) {
SPDK_ERRLOG("Failed to get accel framework's IO channel\n");
goto out;
goto err;
}

TAILQ_INIT(&r5ch->xor_retry_queue);
out:
if (status) {
SPDK_ERRLOG("Failed to initialize io channel\n");
raid5f_ioch_destroy(r5f_info, r5ch);
}
return status;
return 0;
err:
SPDK_ERRLOG("Failed to initialize io channel\n");
raid5f_ioch_destroy(r5f_info, r5ch);
return -ENOMEM;
}

static int
Expand Down

0 comments on commit 4114b4a

Please sign in to comment.