Commit 4cc10656 authored by Artur Paszkiewicz's avatar Artur Paszkiewicz Committed by Tomasz Zawadzki
Browse files

module/raid: factor out calling base bdev remove_cb



Change-Id: I83698f93ecbb8b385742b10bc134665aaededc0e
Signed-off-by: default avatarArtur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/20641


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Mellanox Build Bot
parent 8d563e6c
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -1403,6 +1403,17 @@ raid_bdev_find_base_info_by_bdev(struct spdk_bdev *base_bdev)
	return NULL;
}

static void
raid_bdev_remove_base_bdev_done(struct raid_base_bdev_info *base_info, int status)
{
	assert(base_info->remove_scheduled);

	base_info->remove_scheduled = false;
	if (base_info->remove_cb != NULL) {
		base_info->remove_cb(base_info->remove_cb_ctx, status);
	}
}

static void
raid_bdev_remove_base_bdev_write_sb_cb(int status, struct raid_bdev *raid_bdev, void *ctx)
{
@@ -1413,9 +1424,7 @@ raid_bdev_remove_base_bdev_write_sb_cb(int status, struct raid_bdev *raid_bdev,
			    raid_bdev->bdev.name, spdk_strerror(-status));
	}

	if (base_info->remove_cb != NULL) {
		base_info->remove_cb(base_info->remove_cb_ctx, status);
	}
	raid_bdev_remove_base_bdev_done(base_info, status);
}

static void
@@ -1424,8 +1433,6 @@ raid_bdev_remove_base_bdev_on_unquiesced(void *ctx, int status)
	struct raid_base_bdev_info *base_info = ctx;
	struct raid_bdev *raid_bdev = base_info->raid_bdev;

	base_info->remove_scheduled = false;

	if (status != 0) {
		SPDK_ERRLOG("Failed to unquiesce raid bdev %s: %s\n",
			    raid_bdev->bdev.name, spdk_strerror(-status));
@@ -1460,9 +1467,7 @@ raid_bdev_remove_base_bdev_on_unquiesced(void *ctx, int status)
		return;
	}
out:
	if (base_info->remove_cb != NULL) {
		base_info->remove_cb(base_info->remove_cb_ctx, status);
	}
	raid_bdev_remove_base_bdev_done(base_info, status);
}

static void
@@ -1502,10 +1507,7 @@ raid_bdev_remove_base_bdev_on_quiesced(void *ctx, int status)
	if (status != 0) {
		SPDK_ERRLOG("Failed to quiesce raid bdev %s: %s\n",
			    raid_bdev->bdev.name, spdk_strerror(-status));
		base_info->remove_scheduled = false;
		if (base_info->remove_cb != NULL) {
			base_info->remove_cb(base_info->remove_cb_ctx, status);
		}
		raid_bdev_remove_base_bdev_done(base_info, status);
		return;
	}