Lines Matching full:vio
6 #include "vio.h"
43 struct vio *vio = bio->bi_private; in pbn_from_vio_bio() local
44 struct vdo *vdo = vio->completion.vdo; in pbn_from_vio_bio()
80 unsigned int block_count, char *data, struct vio *vio) in allocate_vio_components() argument
100 initialize_vio(vio, bio, block_count, vio_type, priority, vdo); in allocate_vio_components()
101 vio->completion.parent = parent; in allocate_vio_components()
102 vio->data = data; in allocate_vio_components()
107 * create_multi_block_metadata_vio() - Create a vio.
108 * @vdo: The vdo on which the vio will operate.
109 * @vio_type: The type of vio to create.
110 * @priority: The relative priority to assign to the vio.
111 * @parent: The parent of the vio.
112 * @block_count: The size of the vio in blocks.
114 * @vio_ptr: A pointer to hold the new vio.
121 struct vio **vio_ptr) in create_multi_block_metadata_vio()
123 struct vio *vio; in create_multi_block_metadata_vio() local
126 BUILD_BUG_ON(sizeof(struct vio) > 256); in create_multi_block_metadata_vio()
132 result = vdo_allocate(1, struct vio, __func__, &vio); in create_multi_block_metadata_vio()
134 vdo_log_error("metadata vio allocation failure %d", result); in create_multi_block_metadata_vio()
139 data, vio); in create_multi_block_metadata_vio()
141 vdo_free(vio); in create_multi_block_metadata_vio()
145 *vio_ptr = vio; in create_multi_block_metadata_vio()
150 * free_vio_components() - Free the components of a vio embedded in a larger structure.
151 * @vio: The vio to destroy
153 void free_vio_components(struct vio *vio) in free_vio_components() argument
155 if (vio == NULL) in free_vio_components()
158 BUG_ON(is_data_vio(vio)); in free_vio_components()
159 vdo_free_bio(vdo_forget(vio->bio)); in free_vio_components()
163 * free_vio() - Destroy a vio.
164 * @vio: The vio to destroy.
166 void free_vio(struct vio *vio) in free_vio() argument
168 free_vio_components(vio); in free_vio()
169 vdo_free(vio); in free_vio()
173 void vdo_set_bio_properties(struct bio *bio, struct vio *vio, bio_end_io_t callback, in vdo_set_bio_properties() argument
176 struct vdo *vdo = vio->completion.vdo; in vdo_set_bio_properties()
180 vio->bio_zone = ((pbn / config->thread_counts.bio_rotation_interval) % in vdo_set_bio_properties()
183 bio->bi_private = vio; in vdo_set_bio_properties()
192 * vio associated with the bio.
194 int vio_reset_bio(struct vio *vio, char *data, bio_end_io_t callback, in vio_reset_bio() argument
198 struct bio *bio = vio->bio; in vio_reset_bio()
201 vdo_set_bio_properties(bio, vio, callback, bi_opf, pbn); in vio_reset_bio()
206 bio->bi_max_vecs = vio->block_count + 1; in vio_reset_bio()
207 len = VDO_BLOCK_SIZE * vio->block_count; in vio_reset_bio()
242 * update_vio_error_stats() - Update per-vio error stats and log the error.
243 * @vio: The vio which got an error.
246 void update_vio_error_stats(struct vio *vio, const char *format, ...) in update_vio_error_stats() argument
252 struct vdo *vdo = vio->completion.vdo; in update_vio_error_stats()
254 switch (vio->completion.result) { in update_vio_error_stats()
272 vdo_vlog_strerror(priority, vio->completion.result, VDO_LOGGING_MODULE_NAME, in update_vio_error_stats()
277 void vio_record_metadata_io_error(struct vio *vio) in vio_record_metadata_io_error() argument
280 physical_block_number_t pbn = pbn_from_vio_bio(vio->bio); in vio_record_metadata_io_error()
282 if (bio_op(vio->bio) == REQ_OP_READ) { in vio_record_metadata_io_error()
284 } else if ((vio->bio->bi_opf & REQ_PREFLUSH) == REQ_PREFLUSH) { in vio_record_metadata_io_error()
285 description = (((vio->bio->bi_opf & REQ_FUA) == REQ_FUA) ? in vio_record_metadata_io_error()
288 } else if ((vio->bio->bi_opf & REQ_FUA) == REQ_FUA) { in vio_record_metadata_io_error()
294 update_vio_error_stats(vio, in vio_record_metadata_io_error()
295 "Completing %s vio of type %u for physical block %llu with error", in vio_record_metadata_io_error()
296 description, vio->type, (unsigned long long) pbn); in vio_record_metadata_io_error()
300 * make_vio_pool() - Create a new vio pool.
329 "VIO pool buffer", &pool->buffer); in make_vio_pool()
340 &pooled->vio); in make_vio_pool()
355 * free_vio_pool() - Destroy a vio pool.
367 "VIO pool must not have any waiters when being freed"); in free_vio_pool()
369 "VIO pool must not have %zu busy entries when being freed", in free_vio_pool()
372 "VIO pool must not have busy entries when being freed"); in free_vio_pool()
376 free_vio_components(&pooled->vio); in free_vio_pool()
381 "VIO pool must not have missing entries when being freed"); in free_vio_pool()
388 * is_vio_pool_busy() - Check whether an vio pool has outstanding entries.
398 * acquire_vio_from_pool() - Acquire a vio and buffer from the pool (asynchronous).
399 * @pool: The vio pool.
400 * @waiter: Object that is requesting a vio.
421 * return_vio_to_pool() - Return a vio to the pool
422 * @pool: The vio pool.
423 * @vio: The pooled vio to return.
425 void return_vio_to_pool(struct vio_pool *pool, struct pooled_vio *vio) in return_vio_to_pool() argument
428 "vio pool entry returned on same thread as it was acquired"); in return_vio_to_pool()
430 vio->vio.completion.error_handler = NULL; in return_vio_to_pool()
431 vio->vio.completion.parent = NULL; in return_vio_to_pool()
433 vdo_waitq_notify_next_waiter(&pool->waiting, NULL, vio); in return_vio_to_pool()
437 list_move_tail(&vio->pool_entry, &pool->available); in return_vio_to_pool()
478 static void count_all_bios_completed(struct vio *vio, struct bio *bio) in count_all_bios_completed() argument
480 struct atomic_statistics *stats = &vio->completion.vdo->stats; in count_all_bios_completed()
482 if (is_data_vio(vio)) { in count_all_bios_completed()
488 if (vio->type == VIO_TYPE_RECOVERY_JOURNAL) in count_all_bios_completed()
490 else if (vio->type == VIO_TYPE_BLOCK_MAP) in count_all_bios_completed()
496 struct vio *vio = (struct vio *) bio->bi_private; in vdo_count_completed_bios() local
498 atomic64_inc(&vio->completion.vdo->stats.bios_completed); in vdo_count_completed_bios()
499 count_all_bios_completed(vio, bio); in vdo_count_completed_bios()