Commit 75b4f332 authored by Ben Walker's avatar Ben Walker Committed by Changpeng Liu
Browse files

bdev: All bdevs now have a UUID.



For devices that don't have a UUID, the UUID is generated at
registration time. That means that some devices will not have the same
UUID from run to run, but this seems no worse than having no UUID at
all.

Change-Id: Icf6b8517ffcffabafa2b73176dc03d896d0017fe
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459604


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 5317a9f7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -411,8 +411,8 @@ bool spdk_bdev_has_write_cache(const struct spdk_bdev *bdev);
 * \param bdev Block device to query.
 * \return Pointer to UUID.
 *
 * Not all bdevs will have a UUID; in this case, the returned UUID will be
 * the nil UUID (all bytes zero).
 * All bdevs will have a UUID, but not all UUIDs will be persistent across
 * application runs.
 */
const struct spdk_uuid *spdk_bdev_get_uuid(const struct spdk_bdev *bdev);

+2 −1
Original line number Diff line number Diff line
@@ -293,7 +293,8 @@ struct spdk_bdev {
	/**
	 * UUID for this bdev.
	 *
	 * Fill with zeroes if no uuid is available.
	 * Fill with zeroes if no uuid is available. The bdev layer
	 * will automatically populate this if necessary.
	 */
	struct spdk_uuid uuid;

+5 −0
Original line number Diff line number Diff line
@@ -4022,6 +4022,11 @@ spdk_bdev_init(struct spdk_bdev *bdev)
	bdev->internal.qd_poller = NULL;
	bdev->internal.qos = NULL;

	/* If the user didn't specify a uuid, generate one. */
	if (spdk_mem_all_zero(&bdev->uuid, sizeof(bdev->uuid))) {
		spdk_uuid_generate(&bdev->uuid);
	}

	if (spdk_bdev_get_buf_align(bdev) > 1) {
		if (bdev->split_on_optimal_io_boundary) {
			bdev->optimal_io_boundary = spdk_min(bdev->optimal_io_boundary,
+2 −1
Original line number Diff line number Diff line
@@ -26,5 +26,6 @@
    "unmap": $(S),
    "write": $(S),
    "write_zeroes": $(S)
  }
  },
  "uuid": "$(S)"
}