Commit bbccfa09 authored by Artur Paszkiewicz's avatar Artur Paszkiewicz Committed by Jim Harris
Browse files

raid: factor out finishing examine to helper function



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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
parent 3a4dea18
Loading
Loading
Loading
Loading
+16 −9
Original line number Diff line number Diff line
@@ -3865,6 +3865,18 @@ err:
	return rc;
}

static void
raid_bdev_examine_done(void *ctx, int status)
{
	struct spdk_bdev *bdev = ctx;

	if (status != 0) {
		SPDK_ERRLOG("Failed to examine bdev %s: %s\n",
			    bdev->name, spdk_strerror(-status));
	}
	spdk_bdev_module_examine_done(&g_raid_if);
}

static void
raid_bdev_examine_cont(struct spdk_bdev *bdev, const struct raid_bdev_superblock *sb, int status,
		       void *ctx)
@@ -3878,14 +3890,11 @@ raid_bdev_examine_cont(struct spdk_bdev *bdev, const struct raid_bdev_superblock
	case -EINVAL:
		/* no valid superblock, check if it can be claimed anyway */
		raid_bdev_examine_no_sb(bdev);
		break;
	default:
		SPDK_ERRLOG("Failed to examine bdev %s: %s\n",
			    bdev->name, spdk_strerror(-status));
		status = 0;
		break;
	}

	spdk_bdev_module_examine_done(&g_raid_if);
	raid_bdev_examine_done(bdev, status);
}

/*
@@ -3901,7 +3910,7 @@ raid_bdev_examine_cont(struct spdk_bdev *bdev, const struct raid_bdev_superblock
static void
raid_bdev_examine(struct spdk_bdev *bdev)
{
	int rc;
	int rc = 0;

	if (raid_bdev_find_base_info_by_bdev(bdev) != NULL) {
		goto done;
@@ -3914,14 +3923,12 @@ raid_bdev_examine(struct spdk_bdev *bdev)

	rc = raid_bdev_examine_load_sb(bdev->name, raid_bdev_examine_cont, NULL);
	if (rc != 0) {
		SPDK_ERRLOG("Failed to examine bdev %s: %s\n",
			    bdev->name, spdk_strerror(-rc));
		goto done;
	}

	return;
done:
	spdk_bdev_module_examine_done(&g_raid_if);
	raid_bdev_examine_done(bdev, rc);
}

/* Log component for bdev raid bdev module */