Lines Matching refs:vblk_exp
43 static void vduse_blk_inflight_inc(VduseBlkExport *vblk_exp) in vduse_blk_inflight_inc() argument
45 if (qatomic_fetch_inc(&vblk_exp->inflight) == 0) { in vduse_blk_inflight_inc()
47 blk_exp_ref(&vblk_exp->export); in vduse_blk_inflight_inc()
51 static void vduse_blk_inflight_dec(VduseBlkExport *vblk_exp) in vduse_blk_inflight_dec() argument
53 if (qatomic_fetch_dec(&vblk_exp->inflight) == 1) { in vduse_blk_inflight_dec()
58 blk_exp_unref(&vblk_exp->export); in vduse_blk_inflight_dec()
75 VduseBlkExport *vblk_exp = vduse_dev_get_priv(dev); in vduse_blk_virtio_process_req() local
76 VirtioBlkHandler *handler = &vblk_exp->handler; in vduse_blk_virtio_process_req()
92 vduse_blk_inflight_dec(vblk_exp); in vduse_blk_virtio_process_req()
97 VduseBlkExport *vblk_exp = vduse_dev_get_priv(dev); in vduse_blk_vq_handler() local
111 vduse_blk_inflight_inc(vblk_exp); in vduse_blk_vq_handler()
133 VduseBlkExport *vblk_exp = vduse_dev_get_priv(dev); in vduse_blk_enable_queue() local
135 if (!vblk_exp->vqs_started) { in vduse_blk_enable_queue()
139 aio_set_fd_handler(vblk_exp->export.ctx, vduse_queue_get_fd(vq), in vduse_blk_enable_queue()
147 VduseBlkExport *vblk_exp = vduse_dev_get_priv(dev); in vduse_blk_disable_queue() local
154 aio_set_fd_handler(vblk_exp->export.ctx, fd, in vduse_blk_disable_queue()
170 static void vduse_blk_attach_ctx(VduseBlkExport *vblk_exp, AioContext *ctx) in vduse_blk_attach_ctx() argument
172 aio_set_fd_handler(vblk_exp->export.ctx, vduse_dev_get_fd(vblk_exp->dev), in vduse_blk_attach_ctx()
174 vblk_exp->dev); in vduse_blk_attach_ctx()
179 static void vduse_blk_detach_ctx(VduseBlkExport *vblk_exp) in vduse_blk_detach_ctx() argument
181 aio_set_fd_handler(vblk_exp->export.ctx, vduse_dev_get_fd(vblk_exp->dev), in vduse_blk_detach_ctx()
190 VduseBlkExport *vblk_exp = opaque; in blk_aio_attached() local
192 vblk_exp->export.ctx = ctx; in blk_aio_attached()
193 vduse_blk_attach_ctx(vblk_exp, ctx); in blk_aio_attached()
198 VduseBlkExport *vblk_exp = opaque; in blk_aio_detach() local
200 vduse_blk_detach_ctx(vblk_exp); in blk_aio_detach()
201 vblk_exp->export.ctx = NULL; in blk_aio_detach()
207 VduseBlkExport *vblk_exp = container_of(exp, VduseBlkExport, export); in vduse_blk_resize() local
212 vduse_dev_update_config(vblk_exp->dev, sizeof(config.capacity), in vduse_blk_resize()
217 static void vduse_blk_stop_virtqueues(VduseBlkExport *vblk_exp) in vduse_blk_stop_virtqueues() argument
219 for (uint16_t i = 0; i < vblk_exp->num_queues; i++) { in vduse_blk_stop_virtqueues()
220 VduseVirtq *vq = vduse_dev_get_queue(vblk_exp->dev, i); in vduse_blk_stop_virtqueues()
221 vduse_blk_disable_queue(vblk_exp->dev, vq); in vduse_blk_stop_virtqueues()
224 vblk_exp->vqs_started = false; in vduse_blk_stop_virtqueues()
227 static void vduse_blk_start_virtqueues(VduseBlkExport *vblk_exp) in vduse_blk_start_virtqueues() argument
229 vblk_exp->vqs_started = true; in vduse_blk_start_virtqueues()
231 for (uint16_t i = 0; i < vblk_exp->num_queues; i++) { in vduse_blk_start_virtqueues()
232 VduseVirtq *vq = vduse_dev_get_queue(vblk_exp->dev, i); in vduse_blk_start_virtqueues()
233 vduse_blk_enable_queue(vblk_exp->dev, vq); in vduse_blk_start_virtqueues()
240 VduseBlkExport *vblk_exp = container_of(exp, VduseBlkExport, export); in vduse_blk_drained_begin() local
242 vduse_blk_stop_virtqueues(vblk_exp); in vduse_blk_drained_begin()
248 VduseBlkExport *vblk_exp = container_of(exp, VduseBlkExport, export); in vduse_blk_drained_end() local
250 vduse_blk_start_virtqueues(vblk_exp); in vduse_blk_drained_end()
256 VduseBlkExport *vblk_exp = container_of(exp, VduseBlkExport, export); in vduse_blk_drained_poll() local
258 return qatomic_read(&vblk_exp->inflight) > 0; in vduse_blk_drained_poll()
271 VduseBlkExport *vblk_exp = container_of(exp, VduseBlkExport, export); in vduse_blk_exp_create() local
307 vblk_exp->num_queues = num_queues; in vduse_blk_exp_create()
308 vblk_exp->handler.blk = exp->blk; in vduse_blk_exp_create()
309 vblk_exp->handler.serial = g_strdup(vblk_opts->serial ?: ""); in vduse_blk_exp_create()
310 vblk_exp->handler.logical_block_size = logical_block_size; in vduse_blk_exp_create()
311 vblk_exp->handler.writable = opts->writable; in vduse_blk_exp_create()
312 vblk_exp->vqs_started = true; in vduse_blk_exp_create()
344 vblk_exp->dev = vduse_dev_create(vblk_opts->name, VIRTIO_ID_BLOCK, 0, in vduse_blk_exp_create()
348 vblk_exp); in vduse_blk_exp_create()
349 if (!vblk_exp->dev) { in vduse_blk_exp_create()
355 vblk_exp->recon_file = g_strdup_printf("%s/vduse-blk-%s", in vduse_blk_exp_create()
357 if (vduse_set_reconnect_log_file(vblk_exp->dev, vblk_exp->recon_file)) { in vduse_blk_exp_create()
364 vduse_dev_setup_queue(vblk_exp->dev, i, queue_size); in vduse_blk_exp_create()
367 aio_set_fd_handler(exp->ctx, vduse_dev_get_fd(vblk_exp->dev), in vduse_blk_exp_create()
368 on_vduse_dev_kick, NULL, NULL, NULL, vblk_exp->dev); in vduse_blk_exp_create()
371 vblk_exp); in vduse_blk_exp_create()
383 vduse_dev_destroy(vblk_exp->dev); in vduse_blk_exp_create()
384 g_free(vblk_exp->recon_file); in vduse_blk_exp_create()
386 g_free(vblk_exp->handler.serial); in vduse_blk_exp_create()
392 VduseBlkExport *vblk_exp = container_of(exp, VduseBlkExport, export); in vduse_blk_exp_delete() local
395 assert(qatomic_read(&vblk_exp->inflight) == 0); in vduse_blk_exp_delete()
397 vduse_blk_detach_ctx(vblk_exp); in vduse_blk_exp_delete()
399 vblk_exp); in vduse_blk_exp_delete()
400 ret = vduse_dev_destroy(vblk_exp->dev); in vduse_blk_exp_delete()
402 unlink(vblk_exp->recon_file); in vduse_blk_exp_delete()
404 g_free(vblk_exp->recon_file); in vduse_blk_exp_delete()
405 g_free(vblk_exp->handler.serial); in vduse_blk_exp_delete()
411 VduseBlkExport *vblk_exp = container_of(exp, VduseBlkExport, export); in vduse_blk_exp_request_shutdown() local
413 vduse_blk_stop_virtqueues(vblk_exp); in vduse_blk_exp_request_shutdown()