Lines Matching refs:exp

114     const NBDExport *exp; /* associated export */  member
128 NBDExport *exp; member
403 static int nbd_negotiate_send_rep_list(NBDClient *client, NBDExport *exp, in nbd_negotiate_send_rep_list() argument
409 const char *name = exp->name ? exp->name : ""; in nbd_negotiate_send_rep_list()
410 const char *desc = exp->description ? exp->description : ""; in nbd_negotiate_send_rep_list()
447 NBDExport *exp; in nbd_negotiate_handle_list() local
451 QTAILQ_FOREACH(exp, &exports, next) { in nbd_negotiate_handle_list()
452 if (nbd_negotiate_send_rep_list(client, exp, errp)) { in nbd_negotiate_handle_list()
460 static void nbd_check_meta_export(NBDClient *client, NBDExport *exp) in nbd_check_meta_export() argument
462 if (exp != client->contexts.exp) { in nbd_check_meta_export()
504 client->exp = nbd_export_find(name); in nbd_negotiate_handle_export_name()
505 if (!client->exp) { in nbd_negotiate_handle_export_name()
509 nbd_check_meta_export(client, client->exp); in nbd_negotiate_handle_export_name()
511 myflags = client->exp->nbdflags; in nbd_negotiate_handle_export_name()
518 trace_nbd_negotiate_new_style_size_flags(client->exp->size, myflags); in nbd_negotiate_handle_export_name()
519 stq_be_p(buf, client->exp->size); in nbd_negotiate_handle_export_name()
528 QTAILQ_INSERT_TAIL(&client->exp->clients, client, next); in nbd_negotiate_handle_export_name()
529 blk_exp_ref(&client->exp->common); in nbd_negotiate_handle_export_name()
588 NBDExport *exp; in nbd_negotiate_handle_info() local
641 exp = nbd_export_find(name); in nbd_negotiate_handle_info()
642 if (!exp) { in nbd_negotiate_handle_info()
650 nbd_check_meta_export(client, exp); in nbd_negotiate_handle_info()
664 if (exp->description) { in nbd_negotiate_handle_info()
665 size_t len = strlen(exp->description); in nbd_negotiate_handle_info()
669 len, exp->description, errp); in nbd_negotiate_handle_info()
680 check_align = sizes[0] = blk_get_request_alignment(exp->common.blk); in nbd_negotiate_handle_info()
689 sizes[2] = MIN(blk_get_max_transfer(exp->common.blk), NBD_MAX_BUFFER_SIZE); in nbd_negotiate_handle_info()
701 myflags = exp->nbdflags; in nbd_negotiate_handle_info()
709 trace_nbd_negotiate_new_style_size_flags(exp->size, myflags); in nbd_negotiate_handle_info()
710 stq_be_p(buf, exp->size); in nbd_negotiate_handle_info()
725 blk_get_request_alignment(exp->common.blk) > 1) { in nbd_negotiate_handle_info()
740 client->exp = exp; in nbd_negotiate_handle_info()
742 QTAILQ_INSERT_TAIL(&client->exp->clients, client, next); in nbd_negotiate_handle_info()
743 blk_exp_ref(&client->exp->common); in nbd_negotiate_handle_info()
898 meta->allocation_depth = meta->exp->allocation_depth; in nbd_meta_qemu_query()
899 if (meta->exp->nr_export_bitmaps) { in nbd_meta_qemu_query()
900 memset(meta->bitmaps, 1, meta->exp->nr_export_bitmaps); in nbd_meta_qemu_query()
909 meta->allocation_depth = meta->exp->allocation_depth; in nbd_meta_qemu_query()
917 meta->exp->nr_export_bitmaps) { in nbd_meta_qemu_query()
918 memset(meta->bitmaps, 1, meta->exp->nr_export_bitmaps); in nbd_meta_qemu_query()
924 for (i = 0; i < meta->exp->nr_export_bitmaps; i++) { in nbd_meta_qemu_query()
927 bm_name = bdrv_dirty_bitmap_name(meta->exp->export_bitmaps[i]); in nbd_meta_qemu_query()
1026 meta->exp = nbd_export_find(export_name); in nbd_negotiate_meta_queries()
1027 if (meta->exp == NULL) { in nbd_negotiate_meta_queries()
1033 meta->bitmaps = g_new0(bool, meta->exp->nr_export_bitmaps); in nbd_negotiate_meta_queries()
1049 meta->allocation_depth = meta->exp->allocation_depth; in nbd_negotiate_meta_queries()
1050 if (meta->exp->nr_export_bitmaps) { in nbd_negotiate_meta_queries()
1051 memset(meta->bitmaps, 1, meta->exp->nr_export_bitmaps); in nbd_negotiate_meta_queries()
1082 for (i = 0; i < meta->exp->nr_export_bitmaps; i++) { in nbd_negotiate_meta_queries()
1090 bm_name = bdrv_dirty_bitmap_name(meta->exp->export_bitmaps[i]); in nbd_negotiate_meta_queries()
1523 if (client->exp) { in nbd_client_put()
1524 QTAILQ_REMOVE(&client->exp->clients, client, next); in nbd_client_put()
1525 blk_exp_unref(&client->exp->common); in nbd_client_put()
1587 NBDExport *exp = opaque; in blk_aio_attached() local
1590 trace_nbd_blk_aio_attached(exp->name, ctx); in blk_aio_attached()
1592 exp->common.ctx = ctx; in blk_aio_attached()
1594 QTAILQ_FOREACH(client, &exp->clients, next) { in blk_aio_attached()
1603 NBDExport *exp = opaque; in blk_aio_detach() local
1605 trace_nbd_blk_aio_detach(exp->name, exp->common.ctx); in blk_aio_detach()
1607 exp->common.ctx = NULL; in blk_aio_detach()
1612 NBDExport *exp = opaque; in nbd_drained_begin() local
1615 QTAILQ_FOREACH(client, &exp->clients, next) { in nbd_drained_begin()
1622 NBDExport *exp = opaque; in nbd_drained_end() local
1625 QTAILQ_FOREACH(client, &exp->clients, next) { in nbd_drained_end()
1633 NBDExport *exp = opaque; in nbd_drained_poll() local
1636 QTAILQ_FOREACH(client, &exp->clients, next) { in nbd_drained_poll()
1655 NBDExport *exp = container_of(n, NBDExport, eject_notifier); in nbd_eject_notifier() local
1657 blk_exp_request_shutdown(&exp->common); in nbd_eject_notifier()
1660 void nbd_export_set_on_eject_blk(BlockExport *exp, BlockBackend *blk) in nbd_export_set_on_eject_blk() argument
1662 NBDExport *nbd_exp = container_of(exp, NBDExport, common); in nbd_export_set_on_eject_blk()
1663 assert(exp->drv == &blk_exp_nbd); in nbd_export_set_on_eject_blk()
1681 NBDExport *exp = container_of(blk_exp, NBDExport, common); in nbd_export_create() local
1730 QTAILQ_INIT(&exp->clients); in nbd_export_create()
1731 exp->name = g_strdup(name); in nbd_export_create()
1732 exp->description = g_strdup(arg->description); in nbd_export_create()
1733 exp->nbdflags = (NBD_FLAG_HAS_FLAGS | NBD_FLAG_SEND_FLUSH | in nbd_export_create()
1737 exp->nbdflags |= NBD_FLAG_CAN_MULTI_CONN; in nbd_export_create()
1740 exp->nbdflags |= NBD_FLAG_READ_ONLY; in nbd_export_create()
1742 exp->nbdflags |= (NBD_FLAG_SEND_TRIM | NBD_FLAG_SEND_WRITE_ZEROES | in nbd_export_create()
1745 exp->size = QEMU_ALIGN_DOWN(size, BDRV_SECTOR_SIZE); in nbd_export_create()
1750 exp->nr_export_bitmaps++; in nbd_export_create()
1752 exp->export_bitmaps = g_new0(BdrvDirtyBitmap *, exp->nr_export_bitmaps); in nbd_export_create()
1807 exp->export_bitmaps[i] = bm; in nbd_export_create()
1812 for (i = 0; i < exp->nr_export_bitmaps; i++) { in nbd_export_create()
1813 bdrv_dirty_bitmap_set_busy(exp->export_bitmaps[i], true); in nbd_export_create()
1816 exp->allocation_depth = arg->allocation_depth; in nbd_export_create()
1825 blk_add_aio_context_notifier(blk, blk_aio_attached, blk_aio_detach, exp); in nbd_export_create()
1827 blk_set_dev_ops(blk, &nbd_block_ops, exp); in nbd_export_create()
1829 QTAILQ_INSERT_TAIL(&exports, exp, next); in nbd_export_create()
1837 g_free(exp->export_bitmaps); in nbd_export_create()
1838 g_free(exp->name); in nbd_export_create()
1839 g_free(exp->description); in nbd_export_create()
1845 NBDExport *exp; in nbd_export_find() local
1846 QTAILQ_FOREACH(exp, &exports, next) { in nbd_export_find()
1847 if (strcmp(name, exp->name) == 0) { in nbd_export_find()
1848 return exp; in nbd_export_find()
1856 nbd_export_aio_context(NBDExport *exp) in nbd_export_aio_context() argument
1858 return exp->common.ctx; in nbd_export_aio_context()
1863 NBDExport *exp = container_of(blk_exp, NBDExport, common); in nbd_export_request_shutdown() local
1866 blk_exp_ref(&exp->common); in nbd_export_request_shutdown()
1874 QTAILQ_FOREACH_SAFE(client, &exp->clients, next, next) { in nbd_export_request_shutdown()
1877 if (exp->name) { in nbd_export_request_shutdown()
1878 g_free(exp->name); in nbd_export_request_shutdown()
1879 exp->name = NULL; in nbd_export_request_shutdown()
1880 QTAILQ_REMOVE(&exports, exp, next); in nbd_export_request_shutdown()
1882 blk_exp_unref(&exp->common); in nbd_export_request_shutdown()
1888 NBDExport *exp = container_of(blk_exp, NBDExport, common); in nbd_export_delete() local
1890 assert(exp->name == NULL); in nbd_export_delete()
1891 assert(QTAILQ_EMPTY(&exp->clients)); in nbd_export_delete()
1893 g_free(exp->description); in nbd_export_delete()
1894 exp->description = NULL; in nbd_export_delete()
1896 if (exp->eject_notifier_blk) { in nbd_export_delete()
1897 notifier_remove(&exp->eject_notifier); in nbd_export_delete()
1898 blk_unref(exp->eject_notifier_blk); in nbd_export_delete()
1900 blk_remove_aio_context_notifier(exp->common.blk, blk_aio_attached, in nbd_export_delete()
1901 blk_aio_detach, exp); in nbd_export_delete()
1902 blk_set_disable_request_queuing(exp->common.blk, false); in nbd_export_delete()
1904 for (i = 0; i < exp->nr_export_bitmaps; i++) { in nbd_export_delete()
1905 bdrv_dirty_bitmap_set_busy(exp->export_bitmaps[i], false); in nbd_export_delete()
2087 NBDExport *exp = client->exp; in nbd_co_send_sparse_read() local
2093 int status = blk_co_block_status_above(exp->common.blk, NULL, in nbd_co_send_sparse_read()
2126 ret = blk_co_pread(exp->common.blk, offset + progress, pnum, in nbd_co_send_sparse_read()
2461 assert(client->contexts.exp == client->exp); in nbd_co_block_status_payload_read()
2462 nr_bitmaps = client->exp->nr_export_bitmaps; in nbd_co_block_status_payload_read()
2464 request->contexts->exp = client->exp; in nbd_co_block_status_payload_read()
2647 req->data = blk_try_blockalign(client->exp->common.blk, in nbd_co_receive_request()
2672 if (client->exp->nbdflags & NBD_FLAG_READ_ONLY && check_rofs) { in nbd_co_receive_request()
2677 if (request->from > client->exp->size || in nbd_co_receive_request()
2678 request->len > client->exp->size - request->from) { in nbd_co_receive_request()
2681 client->exp->size); in nbd_co_receive_request()
2732 NBDExport *exp = client->exp; in nbd_do_cmd_read() local
2739 ret = blk_co_flush(exp->common.blk); in nbd_do_cmd_read()
2753 ret = blk_co_pread(exp->common.blk, request->from, request->len, data, 0); in nbd_do_cmd_read()
2783 NBDExport *exp = client->exp; in nbd_do_cmd_cache() local
2788 ret = blk_co_preadv(exp->common.blk, request->from, request->len, in nbd_do_cmd_cache()
2804 NBDExport *exp = client->exp; in nbd_handle_request() local
2821 ret = blk_co_pwrite(exp->common.blk, request->from, request->len, data, in nbd_handle_request()
2837 ret = blk_co_pwrite_zeroes(exp->common.blk, request->from, request->len, in nbd_handle_request()
2847 ret = blk_co_flush(exp->common.blk); in nbd_handle_request()
2852 ret = blk_co_pdiscard(exp->common.blk, request->from, request->len); in nbd_handle_request()
2854 ret = blk_co_flush(exp->common.blk); in nbd_handle_request()
2873 exp->common.blk, in nbd_handle_request()
2886 exp->common.blk, in nbd_handle_request()
2897 assert(request->contexts->exp == client->exp); in nbd_handle_request()
2898 for (i = 0; i < client->exp->nr_export_bitmaps; i++) { in nbd_handle_request()
2903 client->exp->export_bitmaps[i], in nbd_handle_request()
3037 aio_co_schedule(client->exp->common.ctx, client->recv_coroutine); in nbd_client_receive_next_request()