2023-11-16 20:00:53 -05:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
/*
|
|
|
|
* Copyright 2023 Red Hat
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef VDO_IO_SUBMITTER_H
|
|
|
|
#define VDO_IO_SUBMITTER_H
|
|
|
|
|
|
|
|
#include <linux/bio.h>
|
|
|
|
|
2025-01-31 21:18:05 -05:00
|
|
|
#include "constants.h"
|
2023-11-16 20:00:53 -05:00
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
struct io_submitter;
|
|
|
|
|
|
|
|
int vdo_make_io_submitter(unsigned int thread_count, unsigned int rotation_interval,
|
|
|
|
unsigned int max_requests_active, struct vdo *vdo,
|
|
|
|
struct io_submitter **io_submitter);
|
|
|
|
|
|
|
|
void vdo_cleanup_io_submitter(struct io_submitter *io_submitter);
|
|
|
|
|
|
|
|
void vdo_free_io_submitter(struct io_submitter *io_submitter);
|
|
|
|
|
2023-08-25 15:16:17 -04:00
|
|
|
void vdo_submit_vio(struct vdo_completion *completion);
|
2023-11-16 20:00:53 -05:00
|
|
|
|
2023-08-25 14:52:05 -04:00
|
|
|
void vdo_submit_data_vio(struct data_vio *data_vio);
|
2023-11-16 20:00:53 -05:00
|
|
|
|
2023-08-25 14:36:46 -04:00
|
|
|
void __submit_metadata_vio(struct vio *vio, physical_block_number_t physical,
|
|
|
|
bio_end_io_t callback, vdo_action_fn error_handler,
|
2025-01-31 21:18:05 -05:00
|
|
|
blk_opf_t operation, char *data, int size);
|
2023-11-16 20:00:53 -05:00
|
|
|
|
2023-08-25 14:36:46 -04:00
|
|
|
static inline void vdo_submit_metadata_vio(struct vio *vio, physical_block_number_t physical,
|
|
|
|
bio_end_io_t callback, vdo_action_fn error_handler,
|
2024-02-05 21:04:18 -05:00
|
|
|
blk_opf_t operation)
|
2023-11-16 20:00:53 -05:00
|
|
|
{
|
2023-08-25 14:36:46 -04:00
|
|
|
__submit_metadata_vio(vio, physical, callback, error_handler,
|
2025-01-31 21:18:05 -05:00
|
|
|
operation, vio->data, vio->block_count * VDO_BLOCK_SIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void vdo_submit_metadata_vio_with_size(struct vio *vio,
|
|
|
|
physical_block_number_t physical,
|
|
|
|
bio_end_io_t callback,
|
|
|
|
vdo_action_fn error_handler,
|
|
|
|
blk_opf_t operation,
|
|
|
|
int size)
|
|
|
|
{
|
|
|
|
__submit_metadata_vio(vio, physical, callback, error_handler,
|
|
|
|
operation, vio->data, size);
|
2023-11-16 20:00:53 -05:00
|
|
|
}
|
|
|
|
|
2023-08-25 14:43:30 -04:00
|
|
|
static inline void vdo_submit_flush_vio(struct vio *vio, bio_end_io_t callback,
|
|
|
|
vdo_action_fn error_handler)
|
2023-11-16 20:00:53 -05:00
|
|
|
{
|
|
|
|
/* FIXME: Can we just use REQ_OP_FLUSH? */
|
2023-08-25 14:36:46 -04:00
|
|
|
__submit_metadata_vio(vio, 0, callback, error_handler,
|
2025-01-31 21:18:05 -05:00
|
|
|
REQ_OP_WRITE | REQ_PREFLUSH, NULL, 0);
|
2023-11-16 20:00:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* VDO_IO_SUBMITTER_H */
|