ublk: break ublk_start_disk into two parts
For now, we will still execute the two parts consecutively and synchronously. Follow-up patches will do the second part asynchronously, after the ublk cmds associated with the first part have completed. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I814d885a8a113c3367207d11ae09dd536eb63460 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16403 Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
5f1b5f18ae
commit
69d4ec0708
@ -43,6 +43,7 @@ struct ublk_thread_ctx;
|
||||
static void ublk_submit_bdev_io(struct ublk_queue *q, uint16_t tag);
|
||||
static void ublk_dev_queue_fini(struct ublk_queue *q);
|
||||
static int ublk_poll(void *arg);
|
||||
static int finish_start(struct spdk_ublk_dev *ublk);
|
||||
|
||||
struct ublk_io {
|
||||
void *payload;
|
||||
@ -1321,11 +1322,8 @@ ublk_start_disk(const char *bdev_name, uint32_t ublk_id,
|
||||
uint32_t num_queues, uint32_t queue_depth)
|
||||
{
|
||||
int rc;
|
||||
uint32_t q_id, i;
|
||||
struct spdk_bdev *bdev;
|
||||
struct spdk_ublk_dev *ublk = NULL;
|
||||
struct spdk_thread *ublk_thread;
|
||||
char buf[64];
|
||||
|
||||
if (g_ublk_tgt.active == false) {
|
||||
SPDK_ERRLOG("NO ublk target exist\n");
|
||||
@ -1388,6 +1386,21 @@ ublk_start_disk(const char *bdev_name, uint32_t ublk_id,
|
||||
goto err;
|
||||
}
|
||||
|
||||
return finish_start(ublk);
|
||||
|
||||
err:
|
||||
_ublk_try_close_dev(ublk);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int
|
||||
finish_start(struct spdk_ublk_dev *ublk)
|
||||
{
|
||||
int rc;
|
||||
uint32_t q_id, i;
|
||||
struct spdk_thread *ublk_thread;
|
||||
char buf[64];
|
||||
|
||||
snprintf(buf, 64, "%s%d", UBLK_BLK_CDEV, ublk->ublk_id);
|
||||
ublk->cdev_fd = open(buf, O_RDWR);
|
||||
if (ublk->cdev_fd < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user