loop.c (6ecda70ea9c1bf37d2abdcf52dfe06d023276173) | loop.c (297186d640182eff442c3f473cd053c613f3b558) |
---|---|
1/* 2 * NVMe over Fabrics loopback device. 3 * Copyright (c) 2015-2016 HGST, a Western Digital Company. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms and conditions of the GNU General Public License, 7 * version 2, as published by the Free Software Foundation. 8 * --- 335 unchanged lines hidden (view full) --- 344 345 return 0; 346 347out_destroy_queues: 348 nvme_loop_destroy_io_queues(ctrl); 349 return ret; 350} 351 | 1/* 2 * NVMe over Fabrics loopback device. 3 * Copyright (c) 2015-2016 HGST, a Western Digital Company. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms and conditions of the GNU General Public License, 7 * version 2, as published by the Free Software Foundation. 8 * --- 335 unchanged lines hidden (view full) --- 344 345 return 0; 346 347out_destroy_queues: 348 nvme_loop_destroy_io_queues(ctrl); 349 return ret; 350} 351 |
352static int nvme_loop_connect_io_queues(struct nvme_loop_ctrl *ctrl) 353{ 354 int i, ret; 355 356 for (i = 1; i < ctrl->queue_count; i++) { 357 ret = nvmf_connect_io_queue(&ctrl->ctrl, i); 358 if (ret) 359 return ret; 360 } 361 362 return 0; 363} 364 |
|
352static int nvme_loop_configure_admin_queue(struct nvme_loop_ctrl *ctrl) 353{ 354 int error; 355 356 memset(&ctrl->admin_tag_set, 0, sizeof(ctrl->admin_tag_set)); 357 ctrl->admin_tag_set.ops = &nvme_loop_admin_mq_ops; 358 ctrl->admin_tag_set.queue_depth = NVME_LOOP_AQ_BLKMQ_DEPTH; 359 ctrl->admin_tag_set.reserved_tags = 2; /* connect + keep-alive */ --- 125 unchanged lines hidden (view full) --- 485 mutex_unlock(&nvme_loop_ctrl_mutex); 486} 487 488static void nvme_loop_reset_ctrl_work(struct work_struct *work) 489{ 490 struct nvme_loop_ctrl *ctrl = container_of(work, 491 struct nvme_loop_ctrl, reset_work); 492 bool changed; | 365static int nvme_loop_configure_admin_queue(struct nvme_loop_ctrl *ctrl) 366{ 367 int error; 368 369 memset(&ctrl->admin_tag_set, 0, sizeof(ctrl->admin_tag_set)); 370 ctrl->admin_tag_set.ops = &nvme_loop_admin_mq_ops; 371 ctrl->admin_tag_set.queue_depth = NVME_LOOP_AQ_BLKMQ_DEPTH; 372 ctrl->admin_tag_set.reserved_tags = 2; /* connect + keep-alive */ --- 125 unchanged lines hidden (view full) --- 498 mutex_unlock(&nvme_loop_ctrl_mutex); 499} 500 501static void nvme_loop_reset_ctrl_work(struct work_struct *work) 502{ 503 struct nvme_loop_ctrl *ctrl = container_of(work, 504 struct nvme_loop_ctrl, reset_work); 505 bool changed; |
493 int i, ret; | 506 int ret; |
494 495 nvme_loop_shutdown_ctrl(ctrl); 496 497 ret = nvme_loop_configure_admin_queue(ctrl); 498 if (ret) 499 goto out_disable; 500 501 ret = nvme_loop_init_io_queues(ctrl); 502 if (ret) 503 goto out_destroy_admin; 504 | 507 508 nvme_loop_shutdown_ctrl(ctrl); 509 510 ret = nvme_loop_configure_admin_queue(ctrl); 511 if (ret) 512 goto out_disable; 513 514 ret = nvme_loop_init_io_queues(ctrl); 515 if (ret) 516 goto out_destroy_admin; 517 |
505 for (i = 1; i < ctrl->queue_count; i++) { 506 ret = nvmf_connect_io_queue(&ctrl->ctrl, i); 507 if (ret) 508 goto out_destroy_io; 509 } | 518 ret = nvme_loop_connect_io_queues(ctrl); 519 if (ret) 520 goto out_destroy_io; |
510 511 changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE); 512 WARN_ON_ONCE(!changed); 513 514 nvme_queue_scan(&ctrl->ctrl); 515 nvme_queue_async_events(&ctrl->ctrl); 516 517 nvme_start_queues(&ctrl->ctrl); --- 36 unchanged lines hidden (view full) --- 554 .free_ctrl = nvme_loop_free_ctrl, 555 .submit_async_event = nvme_loop_submit_async_event, 556 .delete_ctrl = nvme_loop_del_ctrl, 557 .get_subsysnqn = nvmf_get_subsysnqn, 558}; 559 560static int nvme_loop_create_io_queues(struct nvme_loop_ctrl *ctrl) 561{ | 521 522 changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE); 523 WARN_ON_ONCE(!changed); 524 525 nvme_queue_scan(&ctrl->ctrl); 526 nvme_queue_async_events(&ctrl->ctrl); 527 528 nvme_start_queues(&ctrl->ctrl); --- 36 unchanged lines hidden (view full) --- 565 .free_ctrl = nvme_loop_free_ctrl, 566 .submit_async_event = nvme_loop_submit_async_event, 567 .delete_ctrl = nvme_loop_del_ctrl, 568 .get_subsysnqn = nvmf_get_subsysnqn, 569}; 570 571static int nvme_loop_create_io_queues(struct nvme_loop_ctrl *ctrl) 572{ |
562 int ret, i; | 573 int ret; |
563 564 ret = nvme_loop_init_io_queues(ctrl); 565 if (ret) 566 return ret; 567 568 memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set)); 569 ctrl->tag_set.ops = &nvme_loop_mq_ops; 570 ctrl->tag_set.queue_depth = ctrl->ctrl.opts->queue_size; --- 12 unchanged lines hidden (view full) --- 583 goto out_destroy_queues; 584 585 ctrl->ctrl.connect_q = blk_mq_init_queue(&ctrl->tag_set); 586 if (IS_ERR(ctrl->ctrl.connect_q)) { 587 ret = PTR_ERR(ctrl->ctrl.connect_q); 588 goto out_free_tagset; 589 } 590 | 574 575 ret = nvme_loop_init_io_queues(ctrl); 576 if (ret) 577 return ret; 578 579 memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set)); 580 ctrl->tag_set.ops = &nvme_loop_mq_ops; 581 ctrl->tag_set.queue_depth = ctrl->ctrl.opts->queue_size; --- 12 unchanged lines hidden (view full) --- 594 goto out_destroy_queues; 595 596 ctrl->ctrl.connect_q = blk_mq_init_queue(&ctrl->tag_set); 597 if (IS_ERR(ctrl->ctrl.connect_q)) { 598 ret = PTR_ERR(ctrl->ctrl.connect_q); 599 goto out_free_tagset; 600 } 601 |
591 for (i = 1; i < ctrl->queue_count; i++) { 592 ret = nvmf_connect_io_queue(&ctrl->ctrl, i); 593 if (ret) 594 goto out_cleanup_connect_q; 595 } | 602 ret = nvme_loop_connect_io_queues(ctrl); 603 if (ret) 604 goto out_cleanup_connect_q; |
596 597 return 0; 598 599out_cleanup_connect_q: 600 blk_cleanup_queue(ctrl->ctrl.connect_q); 601out_free_tagset: 602 blk_mq_free_tag_set(&ctrl->tag_set); 603out_destroy_queues: --- 158 unchanged lines hidden --- | 605 606 return 0; 607 608out_cleanup_connect_q: 609 blk_cleanup_queue(ctrl->ctrl.connect_q); 610out_free_tagset: 611 blk_mq_free_tag_set(&ctrl->tag_set); 612out_destroy_queues: --- 158 unchanged lines hidden --- |