bdev/virtio: Use spdk_bdev_open_ext() instead of spdk_bdev_open()

It is not really necessary to replace spdk_bdev_open() by
spdk_bdev_open_ext() for virtio scsi bdev, but spdk_bdev_open() has been
deprecated. Hence do the replacement in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I995c01c3c5842b306497e32099f6cfe767333091
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4725
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Shuhei Matsumoto 2020-10-15 08:17:02 +09:00 committed by Tomasz Zawadzki
parent 5885a8ab43
commit aed3d21eca

View File

@ -1310,14 +1310,26 @@ process_scan_inquiry(struct virtio_scsi_scan_base *base)
} }
static void static void
bdev_virtio_disc_notify_remove(void *remove_ctx) bdev_virtio_disk_notify_remove(struct virtio_scsi_disk *disk)
{ {
struct virtio_scsi_disk *disk = remove_ctx;
disk->removed = true; disk->removed = true;
spdk_bdev_close(disk->notify_desc); spdk_bdev_close(disk->notify_desc);
} }
static void
bdev_virtio_disk_notify_event_cb(enum spdk_bdev_event_type type, struct spdk_bdev *bdev,
void *event_ctx)
{
switch (type) {
case SPDK_BDEV_EVENT_REMOVE:
bdev_virtio_disk_notify_remove(event_ctx);
break;
default:
SPDK_NOTICELOG("Unsupported bdev event: type %d\n", type);
break;
}
}
/* To be called only from the thread performing target scan */ /* To be called only from the thread performing target scan */
static int static int
virtio_scsi_dev_add_tgt(struct virtio_scsi_dev *svdev, struct virtio_scsi_scan_info *info) virtio_scsi_dev_add_tgt(struct virtio_scsi_dev *svdev, struct virtio_scsi_scan_info *info)
@ -1373,7 +1385,8 @@ virtio_scsi_dev_add_tgt(struct virtio_scsi_dev *svdev, struct virtio_scsi_scan_i
return rc; return rc;
} }
rc = spdk_bdev_open(bdev, false, bdev_virtio_disc_notify_remove, disk, &disk->notify_desc); rc = spdk_bdev_open_ext(bdev->name, false, bdev_virtio_disk_notify_event_cb,
disk, &disk->notify_desc);
if (rc) { if (rc) {
assert(false); assert(false);
} }